@productbrain/cli 0.1.0-beta.4806 → 0.1.0-beta.4818
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/__tests__/config-prod-fallthrough.test.js +23 -12
- package/dist/__tests__/config-prod-fallthrough.test.js.map +1 -1
- package/dist/__tests__/config.test.js +354 -11
- package/dist/__tests__/config.test.js.map +1 -1
- package/dist/__tests__/init.test.js +51 -14
- package/dist/__tests__/init.test.js.map +1 -1
- package/dist/__tests__/session-switch.test.js +29 -1
- package/dist/__tests__/session-switch.test.js.map +1 -1
- package/dist/__tests__/state.test.js +21 -1
- package/dist/__tests__/state.test.js.map +1 -1
- package/dist/commands/__tests__/setup-state.test.js +1 -1
- package/dist/commands/__tests__/setup-state.test.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +101 -35
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/doctor.test.js +182 -6
- package/dist/commands/doctor.test.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +20 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +8 -10
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +102 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/status.test.d.ts +2 -0
- package/dist/commands/status.test.d.ts.map +1 -0
- package/dist/commands/status.test.js +75 -0
- package/dist/commands/status.test.js.map +1 -0
- package/dist/commands/welcome.d.ts.map +1 -1
- package/dist/commands/welcome.js +5 -2
- package/dist/commands/welcome.js.map +1 -1
- package/dist/index.js +3 -112
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +17 -30
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +47 -109
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/configResult.d.ts +80 -0
- package/dist/lib/configResult.d.ts.map +1 -0
- package/dist/lib/configResult.js +176 -0
- package/dist/lib/configResult.js.map +1 -0
- package/dist/lib/localBinding.d.ts +51 -0
- package/dist/lib/localBinding.d.ts.map +1 -0
- package/dist/lib/localBinding.js +90 -0
- package/dist/lib/localBinding.js.map +1 -0
- package/dist/lib/projectConfig.d.ts +6 -0
- package/dist/lib/projectConfig.d.ts.map +1 -1
- package/dist/lib/projectConfig.js +14 -2
- package/dist/lib/projectConfig.js.map +1 -1
- package/dist/lib/state.d.ts +7 -0
- package/dist/lib/state.d.ts.map +1 -1
- package/dist/lib/state.js +7 -2
- package/dist/lib/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-local binding resolution — turns what `.productbrain/config.local.json` declares into a
|
|
3
|
+
* credential, or refuses outright.
|
|
4
|
+
*
|
|
5
|
+
* Both cascades that serve ordinary commands (`resolveConfig()`'s return path and `loadEnv()`'s
|
|
6
|
+
* process.env path) call these two helpers, so the refusal rules cannot drift apart between them
|
|
7
|
+
* (STD-3). The shared rule is the same in both: when the repo has declared a tenant, resolution
|
|
8
|
+
* either honors that declaration or fails loudly — it never substitutes a different workspace and
|
|
9
|
+
* carries on. Fail loud, fail closed, fail fast (PRI-24); default closed, explicitly opened
|
|
10
|
+
* (PRI-22).
|
|
11
|
+
*
|
|
12
|
+
* `adminConfig.ts` keeps its own inline copy on purpose: it excludes config.json's siteUrl and the
|
|
13
|
+
* CWD .env files, so it is a narrower cascade, not this one. Folding it in is the remaining step
|
|
14
|
+
* toward a single code path (STA-3).
|
|
15
|
+
*/
|
|
16
|
+
import type { LocalProjectConfig } from './projectConfig.js';
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the repo-local profile pin to a credential, or refuse outright.
|
|
19
|
+
*
|
|
20
|
+
* FAILS CLOSED on a DANGLING pin: a pin naming a profile that has since been deleted, or whose
|
|
21
|
+
* file carries no key, must NEVER fall through to the global active profile. The repo has
|
|
22
|
+
* explicitly declared its tenant; substituting a different one silently retargets every read AND
|
|
23
|
+
* write at a foreign workspace, and the gateway derives the workspace from the credential (BR-18)
|
|
24
|
+
* — so nothing downstream catches it.
|
|
25
|
+
*
|
|
26
|
+
* INS-2455 is the admin-path instance of exactly this fall-through: `resolveAdminConfig()` was
|
|
27
|
+
* hardened on its own, which left the two cascades every other command uses still fail-open.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolvePinnedProfile(profileName: string): {
|
|
30
|
+
apiKey: string;
|
|
31
|
+
siteUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the direct credential binding in config.local.json, or null when the file does not
|
|
35
|
+
* claim one (the profile pin then owns resolution).
|
|
36
|
+
*
|
|
37
|
+
* The claim is the `preview` marker OR a credential of its own — deliberately NOT the marker
|
|
38
|
+
* alone. A file carrying an apiKey is asserting which workspace this repo talks to whether or not
|
|
39
|
+
* `pb:preview` stamped the marker, so gating on the marker would let a hand-written or
|
|
40
|
+
* partially-scrubbed binding be skipped and a sibling profile pin silently supply a different
|
|
41
|
+
* tenant's credential instead (the failure class TEN-3237/TEN-3238 closed for the pin path).
|
|
42
|
+
*
|
|
43
|
+
* Once claimed, only the atomic apiKey+siteUrl pair (SF-3) may bind — never a preview key paired
|
|
44
|
+
* with config.json's real-dev gateway (STD-261). Anything else refuses here, ahead of the pin, so
|
|
45
|
+
* a broken binding is named rather than routed around.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveLocalBinding(localConfig: LocalProjectConfig | null): {
|
|
48
|
+
apiKey: string;
|
|
49
|
+
siteUrl: string;
|
|
50
|
+
} | null;
|
|
51
|
+
//# sourceMappingURL=localBinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localBinding.d.ts","sourceRoot":"","sources":["../../src/lib/localBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAqB9F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,kBAAkB,GAAG,IAAI,GACrC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA2B5C"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-local binding resolution — turns what `.productbrain/config.local.json` declares into a
|
|
3
|
+
* credential, or refuses outright.
|
|
4
|
+
*
|
|
5
|
+
* Both cascades that serve ordinary commands (`resolveConfig()`'s return path and `loadEnv()`'s
|
|
6
|
+
* process.env path) call these two helpers, so the refusal rules cannot drift apart between them
|
|
7
|
+
* (STD-3). The shared rule is the same in both: when the repo has declared a tenant, resolution
|
|
8
|
+
* either honors that declaration or fails loudly — it never substitutes a different workspace and
|
|
9
|
+
* carries on. Fail loud, fail closed, fail fast (PRI-24); default closed, explicitly opened
|
|
10
|
+
* (PRI-22).
|
|
11
|
+
*
|
|
12
|
+
* `adminConfig.ts` keeps its own inline copy on purpose: it excludes config.json's siteUrl and the
|
|
13
|
+
* CWD .env files, so it is a narrower cascade, not this one. Folding it in is the remaining step
|
|
14
|
+
* toward a single code path (STA-3).
|
|
15
|
+
*/
|
|
16
|
+
import { ConfigResolutionError } from './configResult.js';
|
|
17
|
+
import { ErrorCode } from './errors.js';
|
|
18
|
+
import { resolveNamedProfileConfig } from './profiles.js';
|
|
19
|
+
import { API_KEY_PREFIX } from './tokenConstants.js';
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the repo-local profile pin to a credential, or refuse outright.
|
|
22
|
+
*
|
|
23
|
+
* FAILS CLOSED on a DANGLING pin: a pin naming a profile that has since been deleted, or whose
|
|
24
|
+
* file carries no key, must NEVER fall through to the global active profile. The repo has
|
|
25
|
+
* explicitly declared its tenant; substituting a different one silently retargets every read AND
|
|
26
|
+
* write at a foreign workspace, and the gateway derives the workspace from the credential (BR-18)
|
|
27
|
+
* — so nothing downstream catches it.
|
|
28
|
+
*
|
|
29
|
+
* INS-2455 is the admin-path instance of exactly this fall-through: `resolveAdminConfig()` was
|
|
30
|
+
* hardened on its own, which left the two cascades every other command uses still fail-open.
|
|
31
|
+
*/
|
|
32
|
+
export function resolvePinnedProfile(profileName) {
|
|
33
|
+
const namedConfig = resolveNamedProfileConfig(profileName);
|
|
34
|
+
// Same validity bar as adminConfig.ts: a present-but-malformed key is a broken pin, not a
|
|
35
|
+
// credential. Accepting it here would surface as a generic "no API key, run pb login" far
|
|
36
|
+
// downstream, pointing the operator away from the pin that actually broke.
|
|
37
|
+
if (!namedConfig?.apiKey?.startsWith(API_KEY_PREFIX)) {
|
|
38
|
+
throw new ConfigResolutionError(`This repo is pinned to profile "${profileName}" (.productbrain/config.local.json), ` +
|
|
39
|
+
`but that profile has no valid API key — it may have been deleted or never fully set up. ` +
|
|
40
|
+
`Refusing to silently fall back to a different workspace. ` +
|
|
41
|
+
`Run \`pb profile use --local <profile>\` to fix the pin, or \`pb profile create ${profileName}\` to restore it.`, {
|
|
42
|
+
code: ErrorCode.AUTH_MISSING,
|
|
43
|
+
category: 'auth',
|
|
44
|
+
kind: 'profile-pin',
|
|
45
|
+
nextCommand: 'pb profile use --local <profile>',
|
|
46
|
+
guidance: 'Run `pb profile use --local <profile>` to fix the repo pin.',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return { apiKey: namedConfig.apiKey, siteUrl: namedConfig.siteUrl };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the direct credential binding in config.local.json, or null when the file does not
|
|
53
|
+
* claim one (the profile pin then owns resolution).
|
|
54
|
+
*
|
|
55
|
+
* The claim is the `preview` marker OR a credential of its own — deliberately NOT the marker
|
|
56
|
+
* alone. A file carrying an apiKey is asserting which workspace this repo talks to whether or not
|
|
57
|
+
* `pb:preview` stamped the marker, so gating on the marker would let a hand-written or
|
|
58
|
+
* partially-scrubbed binding be skipped and a sibling profile pin silently supply a different
|
|
59
|
+
* tenant's credential instead (the failure class TEN-3237/TEN-3238 closed for the pin path).
|
|
60
|
+
*
|
|
61
|
+
* Once claimed, only the atomic apiKey+siteUrl pair (SF-3) may bind — never a preview key paired
|
|
62
|
+
* with config.json's real-dev gateway (STD-261). Anything else refuses here, ahead of the pin, so
|
|
63
|
+
* a broken binding is named rather than routed around.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveLocalBinding(localConfig) {
|
|
66
|
+
if (!localConfig)
|
|
67
|
+
return null;
|
|
68
|
+
const claimsBinding = localConfig.preview === true || Boolean(localConfig.apiKey) || localConfig.apiKeyMalformed === true;
|
|
69
|
+
if (!claimsBinding)
|
|
70
|
+
return null;
|
|
71
|
+
if (localConfig.apiKey && localConfig.siteUrl) {
|
|
72
|
+
return { apiKey: localConfig.apiKey, siteUrl: localConfig.siteUrl.replace(/\/$/, '') };
|
|
73
|
+
}
|
|
74
|
+
// A malformed key is present-but-unusable, not absent — readLocalProjectConfig() withholds it
|
|
75
|
+
// from `apiKey` so it can never bind, and flags it so this refusal can name the real fault.
|
|
76
|
+
const fault = localConfig.apiKeyMalformed
|
|
77
|
+
? `its API key is not a valid ${API_KEY_PREFIX} key`
|
|
78
|
+
: !localConfig.apiKey
|
|
79
|
+
? 'missing API key'
|
|
80
|
+
: 'missing deployment URL';
|
|
81
|
+
throw new ConfigResolutionError(`This repo has an incomplete preview binding (.productbrain/config.local.json): ` +
|
|
82
|
+
`${fault}. Refusing to use its profile pin or another workspace instead.`, {
|
|
83
|
+
code: ErrorCode.CONFIG_INVALID,
|
|
84
|
+
category: 'config',
|
|
85
|
+
kind: 'preview-binding',
|
|
86
|
+
nextCommand: 'npm run pb:preview',
|
|
87
|
+
guidance: 'Run `npm run pb:preview` to repair the preview binding, or `npm run pb:real` to return to the repo pin.',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=localBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localBinding.js","sourceRoot":"","sources":["../../src/lib/localBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,MAAM,WAAW,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAC3D,0FAA0F;IAC1F,0FAA0F;IAC1F,2EAA2E;IAC3E,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,qBAAqB,CAC7B,mCAAmC,WAAW,uCAAuC;YACnF,0FAA0F;YAC1F,2DAA2D;YAC3D,mFAAmF,WAAW,mBAAmB,EACnH;YACE,IAAI,EAAE,SAAS,CAAC,YAAY;YAC5B,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,6DAA6D;SACxE,CACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAsC;IAEtC,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,aAAa,GACjB,WAAW,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,eAAe,KAAK,IAAI,CAAC;IACtG,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;IACzF,CAAC;IAED,8FAA8F;IAC9F,4FAA4F;IAC5F,MAAM,KAAK,GAAG,WAAW,CAAC,eAAe;QACvC,CAAC,CAAC,8BAA8B,cAAc,MAAM;QACpD,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM;YACnB,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,wBAAwB,CAAC;IAC/B,MAAM,IAAI,qBAAqB,CAC7B,iFAAiF;QAC/E,GAAG,KAAK,iEAAiE,EAC3E;QACE,IAAI,EAAE,SAAS,CAAC,cAAc;QAC9B,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,oBAAoB;QACjC,QAAQ,EAAE,yGAAyG;KACpH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -22,6 +22,12 @@ export interface LocalProjectConfig {
|
|
|
22
22
|
profile?: string;
|
|
23
23
|
/** Direct preview API key — set by `npm run pb:preview`, cleared by `npm run pb:real`. */
|
|
24
24
|
apiKey?: string;
|
|
25
|
+
/**
|
|
26
|
+
* An `apiKey` was present but failed the `API_KEY_PREFIX` bar, so it was not loaded.
|
|
27
|
+
* Kept apart from `apiKey` so a malformed key can never bind, while diagnostics can still
|
|
28
|
+
* say "malformed" instead of misreporting it as absent.
|
|
29
|
+
*/
|
|
30
|
+
apiKeyMalformed?: boolean;
|
|
25
31
|
/** Preview site URL — set alongside apiKey by `npm run pb:preview`. */
|
|
26
32
|
siteUrl?: string;
|
|
27
33
|
/** Marks this config as preview-bound; the CLI shows a loud banner on every command. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectConfig.d.ts","sourceRoot":"","sources":["../../src/lib/projectConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,IAAI,CAuBxD;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"projectConfig.d.ts","sourceRoot":"","sources":["../../src/lib/projectConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB/D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,IAAI,CAuBxD;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,GAAG,IAAI,CA8ClE"}
|
|
@@ -107,8 +107,20 @@ export function readLocalProjectConfig() {
|
|
|
107
107
|
result.profile = parsed.profile;
|
|
108
108
|
}
|
|
109
109
|
// Preview binding fields — written by `npm run pb:preview`, cleared by `npm run pb:real`.
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
//
|
|
111
|
+
// Fail closed on ANY present-but-invalid apiKey, not just a wrong-prefix string: a number,
|
|
112
|
+
// an empty string, a boolean or an object is a corrupt or hand-written binding, and treating
|
|
113
|
+
// it as absent would let the caller skip the claimed binding and adopt a sibling profile pin
|
|
114
|
+
// — the workspace substitution this whole path exists to prevent. Only `undefined`/`null`
|
|
115
|
+
// count as absent: JSON `null` conventionally means "no value", and `npm run pb:real` strips
|
|
116
|
+
// the preview keys entirely rather than nulling them.
|
|
117
|
+
if (parsed.apiKey !== undefined && parsed.apiKey !== null) {
|
|
118
|
+
if (typeof parsed.apiKey === 'string' && parsed.apiKey.startsWith(API_KEY_PREFIX)) {
|
|
119
|
+
result.apiKey = parsed.apiKey;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
result.apiKeyMalformed = true;
|
|
123
|
+
}
|
|
112
124
|
}
|
|
113
125
|
if (typeof parsed.siteUrl === 'string' && parsed.siteUrl) {
|
|
114
126
|
result.siteUrl = parsed.siteUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectConfig.js","sourceRoot":"","sources":["../../src/lib/projectConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"projectConfig.js","sourceRoot":"","sources":["../../src/lib/projectConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA0BrD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;QAC5C,IACE,UAAU,CAAC,KAAK,CAAC;YACjB,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;gBACxC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAClD,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,GAAG,IAAI,GAA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AAC;QACD,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACzD,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC5B,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,IAAI,OAAO,MAAM,CAAC,aAAa,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACrE,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC9C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/lib/state.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* workspace-bound → key + workspace reachable, but no active session
|
|
12
12
|
* active → key + workspace + active session
|
|
13
13
|
*/
|
|
14
|
+
import { type ConfigFailureKind } from './config.js';
|
|
14
15
|
/** Four-stage setup journey from cold start to active use. */
|
|
15
16
|
export type SetupStage = 'unconfigured' | 'authenticated' | 'workspace-bound' | 'active';
|
|
16
17
|
export interface SetupState {
|
|
@@ -25,6 +26,12 @@ export interface SetupState {
|
|
|
25
26
|
entryCount?: number;
|
|
26
27
|
/** Whether a write session is currently active. */
|
|
27
28
|
sessionActive?: boolean;
|
|
29
|
+
/** Exact local-binding failure, when this is more specific than ordinary first-time setup. */
|
|
30
|
+
configurationIssue?: {
|
|
31
|
+
kind: ConfigFailureKind;
|
|
32
|
+
reason: string;
|
|
33
|
+
guidance: string;
|
|
34
|
+
};
|
|
28
35
|
}
|
|
29
36
|
/** Output render tier for the current runtime context. */
|
|
30
37
|
export type RenderTier = 'json' | 'plain' | 'ink';
|
package/dist/lib/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/lib/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/lib/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AASpE,8DAA8D;AAC9D,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,eAAe,GAAG,iBAAiB,GAAG,QAAQ,CAAC;AAEzF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,mFAAmF;IACnF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE;QACnB,IAAI,EAAE,iBAAiB,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAMlD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAgD7D;AAMD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAI7C"}
|
package/dist/lib/state.js
CHANGED
|
@@ -34,8 +34,13 @@ export async function resolveSetupState() {
|
|
|
34
34
|
if (!configResult.ok) {
|
|
35
35
|
return {
|
|
36
36
|
stage: 'unconfigured',
|
|
37
|
-
missingSteps: [
|
|
38
|
-
nextAction:
|
|
37
|
+
missingSteps: [configResult.reason],
|
|
38
|
+
nextAction: configResult.nextCommand,
|
|
39
|
+
configurationIssue: {
|
|
40
|
+
kind: configResult.kind,
|
|
41
|
+
reason: configResult.reason,
|
|
42
|
+
guidance: configResult.guidance,
|
|
43
|
+
},
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
46
|
// Step 2 — can we reach the workspace?
|
package/dist/lib/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/lib/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/lib/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAgCzC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,qCAAqC;IACrC,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC;IACrC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;QACrB,OAAO;YACL,KAAK,EAAE,cAAc;YACrB,YAAY,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;YACnC,UAAU,EAAE,YAAY,CAAC,WAAW;YACpC,kBAAkB,EAAE;gBAClB,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,MAAM,EAAE,YAAY,CAAC,MAAM;gBAC3B,QAAQ,EAAE,YAAY,CAAC,QAAQ;aAChC;SACF,CAAC;IACJ,CAAC;IAED,uC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