@spec0/cli 0.1.0
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/AGENTS.md +67 -0
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/dist/commands/api/changelog.d.ts +9 -0
- package/dist/commands/api/changelog.d.ts.map +1 -0
- package/dist/commands/api/changelog.js +144 -0
- package/dist/commands/api/changelog.js.map +1 -0
- package/dist/commands/api/index.d.ts +6 -0
- package/dist/commands/api/index.d.ts.map +1 -0
- package/dist/commands/api/index.js +13 -0
- package/dist/commands/api/index.js.map +1 -0
- package/dist/commands/api/list.d.ts +10 -0
- package/dist/commands/api/list.d.ts.map +1 -0
- package/dist/commands/api/list.js +79 -0
- package/dist/commands/api/list.js.map +1 -0
- package/dist/commands/api/show.d.ts +9 -0
- package/dist/commands/api/show.d.ts.map +1 -0
- package/dist/commands/api/show.js +88 -0
- package/dist/commands/api/show.js.map +1 -0
- package/dist/commands/auth.d.ts +6 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +166 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/ci/generate.d.ts +10 -0
- package/dist/commands/ci/generate.d.ts.map +1 -0
- package/dist/commands/ci/generate.js +72 -0
- package/dist/commands/ci/generate.js.map +1 -0
- package/dist/commands/ci/index.d.ts +3 -0
- package/dist/commands/ci/index.d.ts.map +1 -0
- package/dist/commands/ci/index.js +6 -0
- package/dist/commands/ci/index.js.map +1 -0
- package/dist/commands/commands.d.ts +19 -0
- package/dist/commands/commands.d.ts.map +1 -0
- package/dist/commands/commands.js +127 -0
- package/dist/commands/commands.js.map +1 -0
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +102 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +54 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +67 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +6 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +109 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/log.d.ts +6 -0
- package/dist/commands/log.d.ts.map +1 -0
- package/dist/commands/log.js +95 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +59 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/mock/create.d.ts +14 -0
- package/dist/commands/mock/create.d.ts.map +1 -0
- package/dist/commands/mock/create.js +75 -0
- package/dist/commands/mock/create.js.map +1 -0
- package/dist/commands/mock/index.d.ts +9 -0
- package/dist/commands/mock/index.d.ts.map +1 -0
- package/dist/commands/mock/index.js +18 -0
- package/dist/commands/mock/index.js.map +1 -0
- package/dist/commands/mock/list.d.ts +8 -0
- package/dist/commands/mock/list.d.ts.map +1 -0
- package/dist/commands/mock/list.js +52 -0
- package/dist/commands/mock/list.js.map +1 -0
- package/dist/commands/mock/show.d.ts +9 -0
- package/dist/commands/mock/show.d.ts.map +1 -0
- package/dist/commands/mock/show.js +68 -0
- package/dist/commands/mock/show.js.map +1 -0
- package/dist/commands/mock/url.d.ts +10 -0
- package/dist/commands/mock/url.d.ts.map +1 -0
- package/dist/commands/mock/url.js +42 -0
- package/dist/commands/mock/url.js.map +1 -0
- package/dist/commands/mock.d.ts +6 -0
- package/dist/commands/mock.d.ts.map +1 -0
- package/dist/commands/mock.js +116 -0
- package/dist/commands/mock.js.map +1 -0
- package/dist/commands/publish.d.ts +11 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +242 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/pull.d.ts +6 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +62 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +18 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +302 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/register.d.ts +6 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +213 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/search.d.ts +6 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +58 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +86 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync-status.d.ts +14 -0
- package/dist/commands/sync-status.d.ts.map +1 -0
- package/dist/commands/sync-status.js +119 -0
- package/dist/commands/sync-status.js.map +1 -0
- package/dist/commands/team.d.ts +6 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +30 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/version.d.ts +6 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +31 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agent-mode.d.ts +25 -0
- package/dist/lib/agent-mode.d.ts.map +1 -0
- package/dist/lib/agent-mode.js +36 -0
- package/dist/lib/agent-mode.js.map +1 -0
- package/dist/lib/api-client.d.ts +37 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +144 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/auth-context.d.ts +18 -0
- package/dist/lib/auth-context.d.ts.map +1 -0
- package/dist/lib/auth-context.js +48 -0
- package/dist/lib/auth-context.js.map +1 -0
- package/dist/lib/breaking-change.d.ts +12 -0
- package/dist/lib/breaking-change.d.ts.map +1 -0
- package/dist/lib/breaking-change.js +10 -0
- package/dist/lib/breaking-change.js.map +1 -0
- package/dist/lib/ci-detect.d.ts +33 -0
- package/dist/lib/ci-detect.d.ts.map +1 -0
- package/dist/lib/ci-detect.js +136 -0
- package/dist/lib/ci-detect.js.map +1 -0
- package/dist/lib/cli-spec-path.d.ts +6 -0
- package/dist/lib/cli-spec-path.d.ts.map +1 -0
- package/dist/lib/cli-spec-path.js +34 -0
- package/dist/lib/cli-spec-path.js.map +1 -0
- package/dist/lib/codeowners.d.ts +11 -0
- package/dist/lib/codeowners.d.ts.map +1 -0
- package/dist/lib/codeowners.js +43 -0
- package/dist/lib/codeowners.js.map +1 -0
- package/dist/lib/config.d.ts +24 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +49 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/deprecation.d.ts +17 -0
- package/dist/lib/deprecation.d.ts.map +1 -0
- package/dist/lib/deprecation.js +22 -0
- package/dist/lib/deprecation.js.map +1 -0
- package/dist/lib/doctor.d.ts +40 -0
- package/dist/lib/doctor.d.ts.map +1 -0
- package/dist/lib/doctor.js +107 -0
- package/dist/lib/doctor.js.map +1 -0
- package/dist/lib/exit-codes.d.ts +51 -0
- package/dist/lib/exit-codes.d.ts.map +1 -0
- package/dist/lib/exit-codes.js +78 -0
- package/dist/lib/exit-codes.js.map +1 -0
- package/dist/lib/lint.d.ts +18 -0
- package/dist/lib/lint.d.ts.map +1 -0
- package/dist/lib/lint.js +41 -0
- package/dist/lib/lint.js.map +1 -0
- package/dist/lib/local-config-yaml.d.ts +14 -0
- package/dist/lib/local-config-yaml.d.ts.map +1 -0
- package/dist/lib/local-config-yaml.js +29 -0
- package/dist/lib/local-config-yaml.js.map +1 -0
- package/dist/lib/output/index.d.ts +69 -0
- package/dist/lib/output/index.d.ts.map +1 -0
- package/dist/lib/output/index.js +120 -0
- package/dist/lib/output/index.js.map +1 -0
- package/dist/lib/output/table.d.ts +19 -0
- package/dist/lib/output/table.d.ts.map +1 -0
- package/dist/lib/output/table.js +48 -0
- package/dist/lib/output/table.js.map +1 -0
- package/dist/lib/output.d.ts +32 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +64 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/platform-defaults.d.ts +27 -0
- package/dist/lib/platform-defaults.d.ts.map +1 -0
- package/dist/lib/platform-defaults.js +36 -0
- package/dist/lib/platform-defaults.js.map +1 -0
- package/dist/lib/ref-resolver.d.ts +37 -0
- package/dist/lib/ref-resolver.d.ts.map +1 -0
- package/dist/lib/ref-resolver.js +56 -0
- package/dist/lib/ref-resolver.js.map +1 -0
- package/dist/lib/registry-ref.d.ts +10 -0
- package/dist/lib/registry-ref.d.ts.map +1 -0
- package/dist/lib/registry-ref.js +18 -0
- package/dist/lib/registry-ref.js.map +1 -0
- package/dist/lib/spec-finder.d.ts +6 -0
- package/dist/lib/spec-finder.d.ts.map +1 -0
- package/dist/lib/spec-finder.js +42 -0
- package/dist/lib/spec-finder.js.map +1 -0
- package/dist/lib/update-check.d.ts +12 -0
- package/dist/lib/update-check.d.ts.map +1 -0
- package/dist/lib/update-check.js +62 -0
- package/dist/lib/update-check.js.map +1 -0
- package/dist/lib/version.d.ts +17 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +33 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/lib/winspect-yaml.d.ts +14 -0
- package/dist/lib/winspect-yaml.d.ts.map +1 -0
- package/dist/lib/winspect-yaml.js +28 -0
- package/dist/lib/winspect-yaml.js.map +1 -0
- package/dist/types.d.ts +664 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable exit-code contract. These values are part of the CLI's public API —
|
|
3
|
+
* once shipped, they MUST NOT be reused or repurposed. CI pipelines depend on
|
|
4
|
+
* them.
|
|
5
|
+
*
|
|
6
|
+
* See README "Exit codes" section for the user-facing reference.
|
|
7
|
+
*/
|
|
8
|
+
export const ExitCode = {
|
|
9
|
+
/** Operation succeeded. */
|
|
10
|
+
SUCCESS: 0,
|
|
11
|
+
/** Generic / unclassified failure. Avoid; pick a specific code instead. */
|
|
12
|
+
GENERIC: 1,
|
|
13
|
+
/** Bad invocation: missing required arg, conflicting flags, etc. */
|
|
14
|
+
USAGE: 2,
|
|
15
|
+
/** No credentials available, or token expired. Hint at SPEC0_TOKEN. */
|
|
16
|
+
AUTH_MISSING: 3,
|
|
17
|
+
/** Authenticated but lacking required permission (HTTP 403). */
|
|
18
|
+
PERMISSION_DENIED: 4,
|
|
19
|
+
/** Resource (API, mock, environment, …) does not exist (HTTP 404). */
|
|
20
|
+
NOT_FOUND: 5,
|
|
21
|
+
/** Conflict on create/update — e.g. name already taken (HTTP 409). */
|
|
22
|
+
CONFLICT: 6,
|
|
23
|
+
/** Validation failure — e.g. spec lint score below threshold (HTTP 422 or local). */
|
|
24
|
+
VALIDATION: 7,
|
|
25
|
+
/** Rate limit hit (HTTP 429). */
|
|
26
|
+
RATE_LIMITED: 8,
|
|
27
|
+
/** Server-side failure the user can't act on directly (HTTP 5xx). */
|
|
28
|
+
SERVER_ERROR: 9,
|
|
29
|
+
/** Network unreachable, timeout, DNS failure. */
|
|
30
|
+
NETWORK_ERROR: 10,
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Classifies an HTTP-style error into the corresponding exit code. Anything
|
|
34
|
+
* unrecognised falls back to `GENERIC` so callers can chain this safely.
|
|
35
|
+
*/
|
|
36
|
+
export function exitCodeForHttpStatus(status) {
|
|
37
|
+
if (status === undefined)
|
|
38
|
+
return ExitCode.NETWORK_ERROR;
|
|
39
|
+
if (status === 401)
|
|
40
|
+
return ExitCode.AUTH_MISSING;
|
|
41
|
+
if (status === 403)
|
|
42
|
+
return ExitCode.PERMISSION_DENIED;
|
|
43
|
+
if (status === 404)
|
|
44
|
+
return ExitCode.NOT_FOUND;
|
|
45
|
+
if (status === 409)
|
|
46
|
+
return ExitCode.CONFLICT;
|
|
47
|
+
if (status === 422)
|
|
48
|
+
return ExitCode.VALIDATION;
|
|
49
|
+
if (status === 429)
|
|
50
|
+
return ExitCode.RATE_LIMITED;
|
|
51
|
+
if (status >= 500 && status < 600)
|
|
52
|
+
return ExitCode.SERVER_ERROR;
|
|
53
|
+
return ExitCode.GENERIC;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Single exit point. Logs `message` to stderr (if provided) before exiting.
|
|
57
|
+
* Commands MUST go through this rather than calling `process.exit` directly so
|
|
58
|
+
* that future logging / telemetry can hook one place.
|
|
59
|
+
*/
|
|
60
|
+
export function exit(code, message) {
|
|
61
|
+
if (message) {
|
|
62
|
+
process.stderr.write(message.endsWith("\n") ? message : `${message}\n`);
|
|
63
|
+
}
|
|
64
|
+
process.exit(code);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reverse-lookup: turn a numeric exit code into its stable string name
|
|
68
|
+
* ("AUTH_MISSING", "NOT_FOUND", …). Used when emitting structured errors
|
|
69
|
+
* so agents can branch on the symbolic code rather than the number.
|
|
70
|
+
*/
|
|
71
|
+
export function exitCodeName(code) {
|
|
72
|
+
for (const [name, value] of Object.entries(ExitCode)) {
|
|
73
|
+
if (value === code)
|
|
74
|
+
return name;
|
|
75
|
+
}
|
|
76
|
+
return "GENERIC";
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=exit-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../../src/lib/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,2BAA2B;IAC3B,OAAO,EAAE,CAAC;IACV,2EAA2E;IAC3E,OAAO,EAAE,CAAC;IACV,oEAAoE;IACpE,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AO,IAAI,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAoC,EAAE,CAAC;QACxF,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spectral runner for OpenAPI linting
|
|
3
|
+
*/
|
|
4
|
+
export interface LintResult {
|
|
5
|
+
score: number;
|
|
6
|
+
errors: Array<{
|
|
7
|
+
line?: number;
|
|
8
|
+
message: string;
|
|
9
|
+
rule: string;
|
|
10
|
+
}>;
|
|
11
|
+
warnings: Array<{
|
|
12
|
+
line?: number;
|
|
13
|
+
message: string;
|
|
14
|
+
rule: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare function runSpectral(specPath: string, rulesetPath?: string): Promise<LintResult>;
|
|
18
|
+
//# sourceMappingURL=lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/lib/lint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAmC7F"}
|
package/dist/lib/lint.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spectral runner for OpenAPI linting
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import spectralCore from "@stoplight/spectral-core";
|
|
6
|
+
const { Spectral } = spectralCore;
|
|
7
|
+
import { oas } from "@stoplight/spectral-rulesets";
|
|
8
|
+
export async function runSpectral(specPath, rulesetPath) {
|
|
9
|
+
const spectral = new Spectral();
|
|
10
|
+
if (rulesetPath) {
|
|
11
|
+
try {
|
|
12
|
+
// Spectral 6+: load custom ruleset file (YAML/JSON)
|
|
13
|
+
await spectral.loadRuleset(rulesetPath);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
spectral.setRuleset(oas);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
spectral.setRuleset(oas);
|
|
21
|
+
}
|
|
22
|
+
const specContent = readFileSync(specPath, "utf-8");
|
|
23
|
+
const results = await spectral.run(specContent);
|
|
24
|
+
const errors = [];
|
|
25
|
+
const warnings = [];
|
|
26
|
+
for (const r of results) {
|
|
27
|
+
const item = {
|
|
28
|
+
line: r.range?.start?.line,
|
|
29
|
+
message: r.message,
|
|
30
|
+
rule: String(r.code ?? "unknown"),
|
|
31
|
+
};
|
|
32
|
+
if (r.severity === 0)
|
|
33
|
+
errors.push(item);
|
|
34
|
+
else
|
|
35
|
+
warnings.push(item);
|
|
36
|
+
}
|
|
37
|
+
const total = errors.length + warnings.length;
|
|
38
|
+
const score = total === 0 ? 100 : Math.max(0, 100 - errors.length * 10 - warnings.length * 2);
|
|
39
|
+
return { score, errors, warnings };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=lint.js.map
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AAI,CAAC,IAAI,CAAC,CAAC;;YACnC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC9C,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE9F,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Spec0Yaml {
|
|
2
|
+
spec?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
owner?: string;
|
|
5
|
+
namespace?: string;
|
|
6
|
+
strict?: boolean;
|
|
7
|
+
checkBreaking?: boolean;
|
|
8
|
+
"auto-create-team"?: boolean;
|
|
9
|
+
"check-breaking"?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function loadSpec0Yaml(cwd: string): Spec0Yaml | null;
|
|
12
|
+
export declare function checkBreakingFromYaml(y: Spec0Yaml | null): boolean;
|
|
13
|
+
export declare function strictFromYaml(y: Spec0Yaml | null): boolean;
|
|
14
|
+
//# sourceMappingURL=local-config-yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-config-yaml.d.ts","sourceRoot":"","sources":["../../src/lib/local-config-yaml.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAO3D;AACD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAKlE;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAG3D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
const CONFIG_FILENAME = ".spec0.yaml";
|
|
5
|
+
export function loadSpec0Yaml(cwd) {
|
|
6
|
+
const path = join(cwd, CONFIG_FILENAME);
|
|
7
|
+
if (!existsSync(path))
|
|
8
|
+
return null;
|
|
9
|
+
const content = readFileSync(path, "utf-8");
|
|
10
|
+
const doc = YAML.parse(content);
|
|
11
|
+
if (!doc || typeof doc !== "object")
|
|
12
|
+
return null;
|
|
13
|
+
return doc;
|
|
14
|
+
}
|
|
15
|
+
export function checkBreakingFromYaml(y) {
|
|
16
|
+
if (!y)
|
|
17
|
+
return false;
|
|
18
|
+
if (typeof y.checkBreaking === "boolean")
|
|
19
|
+
return y.checkBreaking;
|
|
20
|
+
if (typeof y["check-breaking"] === "boolean")
|
|
21
|
+
return y["check-breaking"];
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
export function strictFromYaml(y) {
|
|
25
|
+
if (!y)
|
|
26
|
+
return false;
|
|
27
|
+
return !!y.strict;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=local-config-yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-config-yaml.js","sourceRoot":"","sources":["../../src/lib/local-config-yaml.ts"],"names":[],"mappings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
|
7
|
+
* emit(ctx, data, (d) => formatTextLines(d));
|
|
8
|
+
*
|
|
9
|
+
* - Progress / log messages always go to stderr (use `progress(ctx, msg)`).
|
|
10
|
+
* - Final result always goes to stdout via `emit()` — exactly one document.
|
|
11
|
+
* - Default format is `text`, auto-coloured when stdout is a TTY.
|
|
12
|
+
*/
|
|
13
|
+
import { type ExitCodeValue } from "../exit-codes.js";
|
|
14
|
+
export type OutputFormat = "text" | "json" | "yaml";
|
|
15
|
+
export interface OutputContext {
|
|
16
|
+
format: OutputFormat;
|
|
17
|
+
/** Whether the stdout we'll print to is a real terminal (colour OK). */
|
|
18
|
+
isTTY: boolean;
|
|
19
|
+
/** Suppress non-essential progress messages on stderr. */
|
|
20
|
+
quiet: boolean;
|
|
21
|
+
/** Print extra diagnostics on stderr (e.g. HTTP traces). */
|
|
22
|
+
verbose: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface OutputOptions {
|
|
25
|
+
output?: string;
|
|
26
|
+
format?: string;
|
|
27
|
+
json?: boolean;
|
|
28
|
+
quiet?: boolean;
|
|
29
|
+
verbose?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build an OutputContext from CLI options. Accepts the new `--output` flag
|
|
33
|
+
* plus the legacy `--json` and `--format` flags for one-minor backwards
|
|
34
|
+
* compatibility (callers that hand-roll deprecation warnings should still do
|
|
35
|
+
* so explicitly via `lib/deprecation.ts`).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveOutputContext(opts?: OutputOptions): OutputContext;
|
|
38
|
+
/**
|
|
39
|
+
* Print the final result. Exactly one call per command.
|
|
40
|
+
* `textRenderer` receives the data and returns a single string for `text` mode.
|
|
41
|
+
*/
|
|
42
|
+
export declare function emit<T>(ctx: OutputContext, data: T, textRenderer: (data: T) => string): void;
|
|
43
|
+
export interface FailOptions {
|
|
44
|
+
/** Short actionable hint ("Set SPEC0_TOKEN", "Run 'spec0 auth login'"). */
|
|
45
|
+
hint?: string;
|
|
46
|
+
/** Additional context the caller wants surfaced in the structured payload. */
|
|
47
|
+
details?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Single structured failure point. Companions `emit()` — same output contract:
|
|
51
|
+
*
|
|
52
|
+
* - In text mode: writes `message` (and hint, if given) to stderr. Matches
|
|
53
|
+
* what the bare `exit(code, message)` helper produces, so human UX is
|
|
54
|
+
* unchanged.
|
|
55
|
+
* - In json / yaml mode: emits `{error: {code, message, hint?, details?}}`
|
|
56
|
+
* on **stdout** so agents see one machine-readable document per invocation
|
|
57
|
+
* regardless of success vs failure. The `code` field uses the symbolic
|
|
58
|
+
* name ("AUTH_MISSING", "NOT_FOUND", …) from exit-codes.ts.
|
|
59
|
+
*
|
|
60
|
+
* Always exits with the numeric exit code — callers can rely on `never`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function fail(ctx: OutputContext, code: ExitCodeValue, message: string, opts?: FailOptions): never;
|
|
63
|
+
/** Guard against accidental use of GENERIC in fail(); callers should pick a specific code. */
|
|
64
|
+
export declare function failGeneric(ctx: OutputContext, message: string, opts?: FailOptions): never;
|
|
65
|
+
/** Progress / status — only printed when not `--quiet`. Always to stderr. */
|
|
66
|
+
export declare function progress(ctx: OutputContext, message: string): void;
|
|
67
|
+
/** Verbose-only diagnostic. */
|
|
68
|
+
export declare function debug(ctx: OutputContext, message: string): void;
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/output/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,OA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@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified output for every command. One way to do a thing — see ROADMAP.md.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
*
|
|
6
|
+
* const ctx = resolveOutputContext(opts);
|
|
7
|
+
* emit(ctx, data, (d) => formatTextLines(d));
|
|
8
|
+
*
|
|
9
|
+
* - Progress / log messages always go to stderr (use `progress(ctx, msg)`).
|
|
10
|
+
* - Final result always goes to stdout via `emit()` — exactly one document.
|
|
11
|
+
* - Default format is `text`, auto-coloured when stdout is a TTY.
|
|
12
|
+
*/
|
|
13
|
+
import { stringify as yamlStringify } from "yaml";
|
|
14
|
+
import { ExitCode, exitCodeName } from "../exit-codes.js";
|
|
15
|
+
import { isAgentMode } from "../agent-mode.js";
|
|
16
|
+
/**
|
|
17
|
+
* Build an OutputContext from CLI options. Accepts the new `--output` flag
|
|
18
|
+
* plus the legacy `--json` and `--format` flags for one-minor backwards
|
|
19
|
+
* compatibility (callers that hand-roll deprecation warnings should still do
|
|
20
|
+
* so explicitly via `lib/deprecation.ts`).
|
|
21
|
+
*/
|
|
22
|
+
export function resolveOutputContext(opts = {}) {
|
|
23
|
+
const fromOutput = normaliseFormat(opts.output);
|
|
24
|
+
const fromFormat = normaliseFormat(opts.format);
|
|
25
|
+
const fromJson = opts.json ? "json" : undefined;
|
|
26
|
+
// Agent mode: default format is json unless the caller passed an explicit
|
|
27
|
+
// --output / --format / --json flag.
|
|
28
|
+
const agent = isAgentMode();
|
|
29
|
+
const fallback = agent ? "json" : "text";
|
|
30
|
+
const format = (fromOutput ?? fromFormat ?? fromJson ?? fallback);
|
|
31
|
+
return {
|
|
32
|
+
format,
|
|
33
|
+
// Agent mode suppresses TTY heuristics (colour, progress bars) regardless
|
|
34
|
+
// of the actual stdout.
|
|
35
|
+
isTTY: agent ? false : Boolean(process.stdout.isTTY),
|
|
36
|
+
quiet: Boolean(opts.quiet) || agent,
|
|
37
|
+
verbose: Boolean(opts.verbose),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function normaliseFormat(raw) {
|
|
41
|
+
if (!raw)
|
|
42
|
+
return undefined;
|
|
43
|
+
const v = raw.toLowerCase().trim();
|
|
44
|
+
if (v === "text" || v === "json" || v === "yaml")
|
|
45
|
+
return v;
|
|
46
|
+
// Legacy --format=github survives until we add native annotations.
|
|
47
|
+
if (v === "github")
|
|
48
|
+
return "text";
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Print the final result. Exactly one call per command.
|
|
53
|
+
* `textRenderer` receives the data and returns a single string for `text` mode.
|
|
54
|
+
*/
|
|
55
|
+
export function emit(ctx, data, textRenderer) {
|
|
56
|
+
if (ctx.format === "json") {
|
|
57
|
+
// Pretty when interactive so humans can read; compact when piped so
|
|
58
|
+
// downstream tools don't get extra whitespace they didn't ask for.
|
|
59
|
+
process.stdout.write(JSON.stringify(data, null, ctx.isTTY ? 2 : 0) + "\n");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (ctx.format === "yaml") {
|
|
63
|
+
process.stdout.write(yamlStringify(data));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
process.stdout.write(textRenderer(data) + "\n");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Single structured failure point. Companions `emit()` — same output contract:
|
|
70
|
+
*
|
|
71
|
+
* - In text mode: writes `message` (and hint, if given) to stderr. Matches
|
|
72
|
+
* what the bare `exit(code, message)` helper produces, so human UX is
|
|
73
|
+
* unchanged.
|
|
74
|
+
* - In json / yaml mode: emits `{error: {code, message, hint?, details?}}`
|
|
75
|
+
* on **stdout** so agents see one machine-readable document per invocation
|
|
76
|
+
* regardless of success vs failure. The `code` field uses the symbolic
|
|
77
|
+
* name ("AUTH_MISSING", "NOT_FOUND", …) from exit-codes.ts.
|
|
78
|
+
*
|
|
79
|
+
* Always exits with the numeric exit code — callers can rely on `never`.
|
|
80
|
+
*/
|
|
81
|
+
export function fail(ctx, code, message, opts = {}) {
|
|
82
|
+
if (ctx.format === "json" || ctx.format === "yaml") {
|
|
83
|
+
const payload = {
|
|
84
|
+
error: {
|
|
85
|
+
code: exitCodeName(code),
|
|
86
|
+
message,
|
|
87
|
+
...(opts.hint ? { hint: opts.hint } : {}),
|
|
88
|
+
...(opts.details ? { details: opts.details } : {}),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
if (ctx.format === "json") {
|
|
92
|
+
process.stdout.write(JSON.stringify(payload, null, ctx.isTTY ? 2 : 0) + "\n");
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
process.stdout.write(yamlStringify(payload));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const tail = opts.hint ? `${message}\n ${opts.hint}` : message;
|
|
100
|
+
process.stderr.write(tail.endsWith("\n") ? tail : `${tail}\n`);
|
|
101
|
+
}
|
|
102
|
+
process.exit(code);
|
|
103
|
+
}
|
|
104
|
+
/** Guard against accidental use of GENERIC in fail(); callers should pick a specific code. */
|
|
105
|
+
export function failGeneric(ctx, message, opts) {
|
|
106
|
+
return fail(ctx, ExitCode.GENERIC, message, opts);
|
|
107
|
+
}
|
|
108
|
+
/** Progress / status — only printed when not `--quiet`. Always to stderr. */
|
|
109
|
+
export function progress(ctx, message) {
|
|
110
|
+
if (ctx.quiet)
|
|
111
|
+
return;
|
|
112
|
+
process.stderr.write(message.endsWith("\n") ? message : `${message}\n`);
|
|
113
|
+
}
|
|
114
|
+
/** Verbose-only diagnostic. */
|
|
115
|
+
export function debug(ctx, message) {
|
|
116
|
+
if (!ctx.verbose)
|
|
117
|
+
return;
|
|
118
|
+
process.stderr.write(message.endsWith("\n") ? message : `${message}\n`);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/output/index.ts"],"names":[],"mapp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,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,KAAK,CAAC,GAAkB,EAAE,OAAe;IACvD,IAAI,CAAC,GAAG,CAAC,OAAO;QAAE,OAAO;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table renderer. Wraps cli-table3 with a small, opinionated API:
|
|
3
|
+
*
|
|
4
|
+
* renderTable(rows, [
|
|
5
|
+
* { key: "name", header: "Name" },
|
|
6
|
+
* { key: "version", header: "Ver" },
|
|
7
|
+
* { key: "team", header: "Team", format: (v) => v ?? "—" },
|
|
8
|
+
* ]);
|
|
9
|
+
*
|
|
10
|
+
* Always returns a string (caller decides where to write it). Uses no colour;
|
|
11
|
+
* the caller is responsible for any chalk wrapping if a TTY is attached.
|
|
12
|
+
*/
|
|
13
|
+
export interface ColumnSpec<T> {
|
|
14
|
+
key: keyof T & string;
|
|
15
|
+
header: string;
|
|
16
|
+
format?: (value: T[keyof T], row: T) => string;
|
|
17
|
+
}
|
|
18
|
+
export declare function renderTable<T extends Record<string, unknown>>(rows: T[], columns: ColumnSpec<T>[]): string;
|
|
19
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/lib/output/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;CAChD;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GACvB,MAAM,CAmCR"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table renderer. Wraps cli-table3 with a small, opinionated API:
|
|
3
|
+
*
|
|
4
|
+
* renderTable(rows, [
|
|
5
|
+
* { key: "name", header: "Name" },
|
|
6
|
+
* { key: "version", header: "Ver" },
|
|
7
|
+
* { key: "team", header: "Team", format: (v) => v ?? "—" },
|
|
8
|
+
* ]);
|
|
9
|
+
*
|
|
10
|
+
* Always returns a string (caller decides where to write it). Uses no colour;
|
|
11
|
+
* the caller is responsible for any chalk wrapping if a TTY is attached.
|
|
12
|
+
*/
|
|
13
|
+
import Table from "cli-table3";
|
|
14
|
+
export function renderTable(rows, columns) {
|
|
15
|
+
const table = new Table({
|
|
16
|
+
head: columns.map((c) => c.header),
|
|
17
|
+
style: { head: [], border: [] }, // disable cli-table3's own colouring
|
|
18
|
+
chars: {
|
|
19
|
+
top: "─",
|
|
20
|
+
"top-mid": "┬",
|
|
21
|
+
"top-left": "┌",
|
|
22
|
+
"top-right": "┐",
|
|
23
|
+
bottom: "─",
|
|
24
|
+
"bottom-mid": "┴",
|
|
25
|
+
"bottom-left": "└",
|
|
26
|
+
"bottom-right": "┘",
|
|
27
|
+
left: "│",
|
|
28
|
+
"left-mid": "├",
|
|
29
|
+
mid: "─",
|
|
30
|
+
"mid-mid": "┼",
|
|
31
|
+
right: "│",
|
|
32
|
+
"right-mid": "┤",
|
|
33
|
+
middle: "│",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
for (const row of rows) {
|
|
37
|
+
table.push(columns.map((c) => {
|
|
38
|
+
const v = row[c.key];
|
|
39
|
+
if (c.format)
|
|
40
|
+
return c.format(v, row);
|
|
41
|
+
if (v === null || v === undefined)
|
|
42
|
+
return "—";
|
|
43
|
+
return String(v);
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return table.toString();
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/lib/output/table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAQ/B,MAAM,UAAU,WAAW,CACzB,IAAS,EACT,OAAwB;IAExB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAClC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,qCAAqC;QACtE,KAAK,EAAE;YACL,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;YAChB,MAAM,EAAE,GAAG;YACX,YAAY,EAAE,GAAG;YACjB,aAAa,EAAE,GAAG;YAClB,cAAc,EAAE,GAAG;YACnB,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,GAAG;YACf,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,GAAG;YACd,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,GAAG;YAChB,MAAM,EAAE,GAAG;SACZ;KACF,CAAC,CAAC;IAEH,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CACR,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAChB,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,CAAC,MAAM;gBAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAe,EAAE,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAC;YAC9C,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatters: text, json, github (GH Actions annotations)
|
|
3
|
+
*/
|
|
4
|
+
export type OutputFormat = "text" | "json" | "github";
|
|
5
|
+
export declare function formatLintText(result: {
|
|
6
|
+
score: number;
|
|
7
|
+
errors: Array<{
|
|
8
|
+
line?: number;
|
|
9
|
+
message: string;
|
|
10
|
+
rule: string;
|
|
11
|
+
}>;
|
|
12
|
+
warnings: Array<{
|
|
13
|
+
line?: number;
|
|
14
|
+
message: string;
|
|
15
|
+
rule: string;
|
|
16
|
+
}>;
|
|
17
|
+
}): string;
|
|
18
|
+
export declare function formatPublishText(output: {
|
|
19
|
+
apiId: string;
|
|
20
|
+
version: string;
|
|
21
|
+
specUrl: string;
|
|
22
|
+
mockUrl?: string;
|
|
23
|
+
apiName?: string;
|
|
24
|
+
teamName?: string;
|
|
25
|
+
registryUrl?: string;
|
|
26
|
+
noChanges?: boolean;
|
|
27
|
+
versionUnchanged?: boolean;
|
|
28
|
+
versionUnchangedHint?: string;
|
|
29
|
+
created?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function formatGitHubAnnotation(file: string, line: number, level: "error" | "warning", message: string): string;
|
|
32
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEtD,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,GAAG,MAAM,CAsBT;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,CAgCT;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,GACd,MAAM,CAER"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatters: text, json, github (GH Actions annotations)
|
|
3
|
+
*/
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
export function formatLintText(result) {
|
|
6
|
+
const lines = [];
|
|
7
|
+
lines.push(` Score: ${result.score}/100`);
|
|
8
|
+
lines.push("");
|
|
9
|
+
lines.push(` Errors (${result.errors.length}):`);
|
|
10
|
+
for (const e of result.errors) {
|
|
11
|
+
lines.push(` line ${e.line ?? "?"} ${e.rule} ${e.message}`);
|
|
12
|
+
}
|
|
13
|
+
if (result.errors.length === 0)
|
|
14
|
+
lines.push(" (none)");
|
|
15
|
+
lines.push("");
|
|
16
|
+
lines.push(` Warnings (${result.warnings.length}):`);
|
|
17
|
+
for (const w of result.warnings) {
|
|
18
|
+
lines.push(` line ${w.line ?? "?"} ${w.rule} ${w.message}`);
|
|
19
|
+
}
|
|
20
|
+
if (result.warnings.length === 0)
|
|
21
|
+
lines.push(" (none)");
|
|
22
|
+
lines.push("");
|
|
23
|
+
if (result.errors.length === 0) {
|
|
24
|
+
lines.push(chalk.green(" ✓ 0 errors. Spec is publishable."));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
lines.push(chalk.red(` ✗ ${result.errors.length} errors. Fix before publishing.`));
|
|
28
|
+
}
|
|
29
|
+
return lines.join("\n");
|
|
30
|
+
}
|
|
31
|
+
export function formatPublishText(output) {
|
|
32
|
+
const lines = [];
|
|
33
|
+
if (output.noChanges) {
|
|
34
|
+
lines.push(chalk.green("✓ Already up to date") + chalk.gray(" (git SHA unchanged)"));
|
|
35
|
+
if (output.apiName)
|
|
36
|
+
lines.push(` api: ${output.apiName} @ v${output.version}`);
|
|
37
|
+
if (output.registryUrl)
|
|
38
|
+
lines.push(` registry: ${output.registryUrl}`);
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
}
|
|
41
|
+
const label = output.created ? chalk.green("✓ Created") : chalk.green("✓ Updated");
|
|
42
|
+
const nameLabel = output.apiName ?? output.apiId;
|
|
43
|
+
lines.push(`${label} ${chalk.bold(nameLabel)} v${output.version}`);
|
|
44
|
+
if (output.apiName)
|
|
45
|
+
lines.push(` api: ${output.apiName}`);
|
|
46
|
+
if (output.teamName)
|
|
47
|
+
lines.push(` team: ${output.teamName}`);
|
|
48
|
+
if (output.registryUrl)
|
|
49
|
+
lines.push(` registry: ${output.registryUrl}`);
|
|
50
|
+
lines.push(` spec page: ${output.specUrl}`);
|
|
51
|
+
if (output.mockUrl)
|
|
52
|
+
lines.push(` mock: ${output.mockUrl}`);
|
|
53
|
+
if (output.versionUnchanged) {
|
|
54
|
+
lines.push("");
|
|
55
|
+
lines.push(chalk.yellow("⚠ ") +
|
|
56
|
+
chalk.yellow(output.versionUnchangedHint ??
|
|
57
|
+
`Spec changed but version is still ${output.version}. Pass --semver to auto-bump.`));
|
|
58
|
+
}
|
|
59
|
+
return lines.join("\n");
|
|
60
|
+
}
|
|
61
|
+
export function formatGitHubAnnotation(file, line, level, message) {
|
|
62
|
+
return `::${level} file=${file},line=${line}::${message.replace(/\n/g, "%0A")}`;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,UAAU,cAAc,CAAC,MAI9B;IACC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,KAAK,MAAM,CAAC,CAAC;IAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IAClD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,IAAI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M,CAAC,IAAI,CAAC;YAChB,KAAK,CAAC,MAAM,CACV,MAAM,CAAC,oBAAoB;gBACzB,qCAAqC,MAAM,CAAC,OAAO,+BAA+B,CACrF,CACJ,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,IAAY,EACZ,IAAY,EACZ,KAA0B,EAC1B,OAAe;IAEf,OAAO,KAAK,KAAK,SAAS,IAAI,SAAS,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two origins — do not conflate them:
|
|
3
|
+
*
|
|
4
|
+
* - **`SPEC0_APP_URL`** — Web app only: opening the browser for `spec0 auth login`
|
|
5
|
+
* (`/cli-auth`). Also used when printing dashboard links in `spec0 push` output (`specUrl`);
|
|
6
|
+
* that is not an API request.
|
|
7
|
+
* - **`SPEC0_API_URL`** — Spring backend base for **all** programmatic HTTP (push, pull, mock,
|
|
8
|
+
* lint, search, registry, …). Stored on login as `org.apiUrl` and used by
|
|
9
|
+
* `createOrgApiClient` / `createApiClient`.
|
|
10
|
+
*
|
|
11
|
+
* Defaults below match local dev (Next :3000, Spring :8080 + context path). Override both for
|
|
12
|
+
* staging/production. `SPEC0_API_URL` should align with `NEXT_PUBLIC_API_BASE_URL` in
|
|
13
|
+
* api-management-ui, not the Next.js site origin alone.
|
|
14
|
+
*
|
|
15
|
+
* Legacy: `PLATFORM_APP_URL` / `PLATFORM_API_URL` are still accepted as fallbacks.
|
|
16
|
+
*/
|
|
17
|
+
/** Next.js / browser app — CLI auth (`/cli-auth`) and push output links. */
|
|
18
|
+
export declare const DEFAULT_PLATFORM_APP_URL = "https://app.spec0.io";
|
|
19
|
+
/**
|
|
20
|
+
* Spring Boot API base (include servlet context path if your deploy uses one).
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PLATFORM_API_URL = "https://api.spec0.io/api-management";
|
|
23
|
+
/** Web app origin for auth + UI links — never used as the REST base. */
|
|
24
|
+
export declare function resolvedPlatformAppUrl(): string;
|
|
25
|
+
/** Backend base for all CLI REST calls — never derived from the app URL. */
|
|
26
|
+
export declare function resolvedPlatformApiUrl(): string;
|
|
27
|
+
//# sourceMappingURL=platform-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-defaults.d.ts","sourceRoot":"","sources":["../../src/lib/platform-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,wBAAwB,wCAAwC,CAAC;AAM9E,wEAAwE;AACxE,wBAAgB,sBAAsB,IAAI,MAAM,CAG/C;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,IAAI,MAAM,CAG/C"}
|