@remogram/cli 0.1.0-beta.0 → 0.1.0-beta.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.
Files changed (2) hide show
  1. package/index.js +70 -17
  2. package/package.json +7 -7
package/index.js CHANGED
@@ -16,6 +16,8 @@ import {
16
16
  sanitizeField,
17
17
  assertGitRef,
18
18
  assertGitRemote,
19
+ getEffectiveIngestMaxBytes,
20
+ FORGE_INGEST_MAX_BYTES_ENV,
19
21
  } from '@remogram/core';
20
22
  import { provider as giteaApi } from '@remogram/provider-gitea-api';
21
23
  import { provider as githubApi } from '@remogram/provider-github-api';
@@ -87,6 +89,24 @@ function contextFromConfig(config, cwd, parsed = null) {
87
89
  };
88
90
  }
89
91
 
92
+ function finalizeDoctorPacket(ctx, checks, providerCapabilities) {
93
+ const summary = doctorSummary(checks);
94
+ const error =
95
+ summary === 'fail'
96
+ ? forgeError(ERROR_CODES.CONFIG_INVALID, 'Doctor checks failed')
97
+ : null;
98
+ return forgePacket(
99
+ PACKET_TYPES.PROVIDER_DOCTOR,
100
+ ctx,
101
+ {
102
+ summary,
103
+ checks,
104
+ provider_capabilities: providerCapabilities,
105
+ },
106
+ error,
107
+ );
108
+ }
109
+
90
110
  async function buildDoctorPacket(cwd, providers) {
91
111
  const checks = [];
92
112
  const configPath = findConfigPath(cwd);
@@ -98,11 +118,7 @@ async function buildDoctorPacket(cwd, providers) {
98
118
 
99
119
  if (!configPath) {
100
120
  checks.push(doctorCheck('config', 'fail', 'No .remogram.json found'));
101
- return forgePacket(PACKET_TYPES.PROVIDER_DOCTOR, ctx, {
102
- summary: doctorSummary(checks),
103
- checks,
104
- provider_capabilities: null,
105
- });
121
+ return finalizeDoctorPacket(ctx, checks, null);
106
122
  }
107
123
 
108
124
  try {
@@ -112,22 +128,30 @@ async function buildDoctorPacket(cwd, providers) {
112
128
  checks.push(doctorCheck('config', 'pass', '.remogram.json is present and valid'));
113
129
  } catch (err) {
114
130
  checks.push(doctorCheck('config', 'fail', err.forgeError?.message || err.message));
115
- return forgePacket(PACKET_TYPES.PROVIDER_DOCTOR, ctx, {
116
- summary: doctorSummary(checks),
117
- checks,
118
- provider_capabilities: null,
119
- });
131
+ return finalizeDoctorPacket(ctx, checks, null);
120
132
  }
121
133
 
122
134
  const provider = providers[config.provider];
123
135
  if (!provider) {
124
136
  checks.push(doctorCheck('provider', 'fail', `Unsupported provider: ${config.provider}`));
125
137
  } else {
126
- checks.push(doctorCheck('provider', 'pass', `${config.provider} is registered`));
127
138
  if (typeof provider.providerCapabilities === 'function') {
128
139
  providerCapabilities = await provider.providerCapabilities(ctx);
140
+ const stubProvider =
141
+ providerCapabilities.commands?.length > 0
142
+ && providerCapabilities.commands.every((command) => command.implemented === false);
143
+ checks.push(
144
+ doctorCheck(
145
+ 'provider',
146
+ stubProvider ? 'warn' : 'pass',
147
+ stubProvider
148
+ ? `${config.provider} is not implemented in v1; use an *-api provider`
149
+ : `${config.provider} is registered`,
150
+ ),
151
+ );
129
152
  checks.push(doctorCheck('capabilities', 'pass', 'Provider capabilities are available'));
130
153
  } else {
154
+ checks.push(doctorCheck('provider', 'pass', `${config.provider} is registered`));
131
155
  checks.push(doctorCheck('capabilities', 'fail', 'Provider capabilities are not implemented'));
132
156
  }
133
157
  }
@@ -189,13 +213,40 @@ async function buildDoctorPacket(cwd, providers) {
189
213
  }
190
214
  }
191
215
 
216
+ const { bytes: ingestCapBytes, envOverride: ingestEnvOverride, invalidEnv: ingestInvalidEnv } =
217
+ getEffectiveIngestMaxBytes();
218
+ if (ingestInvalidEnv) {
219
+ checks.push(
220
+ doctorCheck(
221
+ 'forge_ingest_cap',
222
+ 'warn',
223
+ `${FORGE_INGEST_MAX_BYTES_ENV} is invalid; using default 8192 bytes`,
224
+ { effective_bytes: ingestCapBytes, env_override: false },
225
+ ),
226
+ );
227
+ } else if (ingestEnvOverride) {
228
+ checks.push(
229
+ doctorCheck(
230
+ 'forge_ingest_cap',
231
+ 'warn',
232
+ `${FORGE_INGEST_MAX_BYTES_ENV} overrides default ingest cap; agent-safe guarantee is weakened`,
233
+ { effective_bytes: ingestCapBytes, env_override: true },
234
+ ),
235
+ );
236
+ } else {
237
+ checks.push(
238
+ doctorCheck(
239
+ 'forge_ingest_cap',
240
+ 'pass',
241
+ 'Forge HTTP ingest cap is default 8192 bytes',
242
+ { effective_bytes: ingestCapBytes, env_override: false },
243
+ ),
244
+ );
245
+ }
246
+
192
247
  checks.push(doctorCheck('api_reachability', 'skipped', 'Live API reachability is not checked by default'));
193
248
 
194
- return forgePacket(PACKET_TYPES.PROVIDER_DOCTOR, ctx, {
195
- summary: doctorSummary(checks),
196
- checks,
197
- provider_capabilities: providerCapabilities,
198
- });
249
+ return finalizeDoctorPacket(ctx, checks, providerCapabilities);
199
250
  }
200
251
 
201
252
  export async function runCli(argv, options = {}) {
@@ -225,7 +276,9 @@ export async function runCli(argv, options = {}) {
225
276
  const [group, sub] = positional;
226
277
 
227
278
  if (group === 'doctor' && sub == null) {
228
- output(await buildDoctorPacket(cwd, providers), asJson);
279
+ const packet = await buildDoctorPacket(cwd, providers);
280
+ output(packet, asJson);
281
+ if (!packet.ok) process.exitCode = 1;
229
282
  return;
230
283
  }
231
284
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remogram/cli",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Remogram forge boundary CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,11 +27,11 @@
27
27
  "node": ">=20"
28
28
  },
29
29
  "dependencies": {
30
- "@remogram/core": "0.1.0-beta.0",
31
- "@remogram/provider-gitea-api": "0.1.0-beta.0",
32
- "@remogram/provider-github-api": "0.1.0-beta.0",
33
- "@remogram/provider-gitlab-api": "0.1.0-beta.0",
34
- "@remogram/provider-gitea-tea": "0.1.0-beta.0",
35
- "@remogram/provider-github-gh": "0.1.0-beta.0"
30
+ "@remogram/core": "0.1.0-beta.1",
31
+ "@remogram/provider-gitea-api": "0.1.0-beta.1",
32
+ "@remogram/provider-github-api": "0.1.0-beta.1",
33
+ "@remogram/provider-gitlab-api": "0.1.0-beta.1",
34
+ "@remogram/provider-gitea-tea": "0.1.0-beta.1",
35
+ "@remogram/provider-github-gh": "0.1.0-beta.1"
36
36
  }
37
37
  }