@formigio/fazemos-cli 0.10.81 → 0.10.85
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/api.d.ts +43 -0
- package/dist/api.js +83 -0
- package/dist/api.js.map +1 -1
- package/dist/commands/floor.d.ts +31 -0
- package/dist/commands/floor.js +367 -0
- package/dist/commands/floor.js.map +1 -0
- package/dist/config.d.ts +24 -10
- package/dist/config.js +0 -8
- package/dist/config.js.map +1 -1
- package/dist/dircontext.d.ts +69 -0
- package/dist/dircontext.js +239 -0
- package/dist/dircontext.js.map +1 -1
- package/dist/dispatch.d.ts +29 -0
- package/dist/dispatch.js +38 -0
- package/dist/dispatch.js.map +1 -1
- package/dist/exitCodes.d.ts +18 -0
- package/dist/exitCodes.js +18 -0
- package/dist/exitCodes.js.map +1 -0
- package/dist/index.js +141 -96
- package/dist/index.js.map +1 -1
- package/dist/preflight/row3_persona.js +3 -1
- package/dist/preflight/row3_persona.js.map +1 -1
- package/dist/types/floor.d.ts +101 -0
- package/dist/types/floor.js +12 -0
- package/dist/types/floor.js.map +1 -0
- package/dist/wake.js +33 -12
- package/dist/wake.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,16 +6,16 @@ import { config, getEnv, getToken, getActiveEnvName, getActiveEnvSource, setEnvO
|
|
|
6
6
|
getActiveProjectId, setActiveProjectId, clearActiveProjectId, findProjectBySlug, findProjectById, findOrgById,
|
|
7
7
|
// Directory-scoped context override (.fazemos.json)
|
|
8
8
|
setOrgOverride, setProjectOverride, setDirContextSource, getDirContextSource, } from './config.js';
|
|
9
|
-
import { findDirContextFile, readDirContextFile, writeDirContextFile, removeDirContextFile, DIR_CONFIG_FILENAME, } from './dircontext.js';
|
|
9
|
+
import { findDirContextFile, readDirContextFile, writeDirContextFile, removeDirContextFile, DIR_CONFIG_FILENAME, applyDirContext, } from './dircontext.js';
|
|
10
10
|
import { loginWithBrowser, hostedLogoutUrl, signup, confirmSignup, adminLogin } from './auth.js';
|
|
11
11
|
import { fetchAuthConfig } from './authConfig.js';
|
|
12
|
-
import { api, ApiError, refreshAuthMeCache, invalidateAuthMeCache, resolveOrgIdMaybeSlug, resolveProjectIdBySlug, patchProjectDocsRepo, patchOrgWorkspace } from './api.js';
|
|
12
|
+
import { api, ApiError, refreshAuthMeCache, invalidateAuthMeCache, resolveOrgIdMaybeSlug, resolveProjectIdBySlug, patchProjectDocsRepo, patchOrgWorkspace, isAgentCredential, fetchCredentialScope } from './api.js';
|
|
13
13
|
import { isProjectConnectionUnavailable, renderProjectConnectionUnavailableCopy, } from './connectionErrorCopy.js';
|
|
14
14
|
import { loadYaml, summarize } from './yaml/load.js';
|
|
15
15
|
import { printFindings, printJson } from './yaml/format.js';
|
|
16
16
|
import { validateManifest } from './manifest/checks.js';
|
|
17
17
|
import { validatePath as validateRunbookPath } from './runbook/checks.js';
|
|
18
|
-
import { findLocalRegistry, resolveRole, buildInboxFile, writeInboxFile, writeInboxFileAtPath, buildRolesSyncPayload, findUnprocessedInboxFiles, computeFileHash, gitCommitInboxFile, gitCommitAndPushInboxFile, isAgentExecution, computeRegistryInboxPath, computeChildDispatchDepth, shouldFallBackToFile, } from './dispatch.js';
|
|
18
|
+
import { findLocalRegistry, resolveRole, buildInboxFile, writeInboxFile, writeInboxFileAtPath, buildRolesSyncPayload, findUnprocessedInboxFiles, computeFileHash, gitCommitInboxFile, gitCommitAndPushInboxFile, isAgentExecution, computeRegistryInboxPath, computeChildDispatchDepth, shouldFallBackToFile, isWakeIneligibleForCadencelessRole, } from './dispatch.js';
|
|
19
19
|
import { execSync } from 'child_process';
|
|
20
20
|
import { registerPauseCommands } from './pause.js';
|
|
21
21
|
import { registerBudgetCommands } from './budget.js';
|
|
@@ -31,6 +31,8 @@ import { registerProfilesCommands } from './commands/profiles.js';
|
|
|
31
31
|
import { registerImageCommands } from './commands/image.js';
|
|
32
32
|
import { registerIngestCommands } from './commands/ingest.js';
|
|
33
33
|
import { registerAssetCommands } from './commands/asset/index.js';
|
|
34
|
+
// F70 — Floor Projection
|
|
35
|
+
import { registerFloorCommands } from './commands/floor.js';
|
|
34
36
|
// F53 — Agent Provisioning Tooling
|
|
35
37
|
import { runPreflight } from './commands/preflight.js';
|
|
36
38
|
import { runProvision } from './commands/provision.js';
|
|
@@ -230,6 +232,8 @@ program
|
|
|
230
232
|
// copyInheritedSettings(), which copies _allowExcessArguments, so every
|
|
231
233
|
// subcommand registered after this line inherits the strict behavior.
|
|
232
234
|
.allowExcessArguments(false);
|
|
235
|
+
/** UUID v4 pattern — used by resolveTemplateId (G15) and elsewhere to detect a pre-resolved id vs. a name/slug. */
|
|
236
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
233
237
|
// ── Directory-scoped default org/project (.fazemos.json) ─────
|
|
234
238
|
//
|
|
235
239
|
// Before any command action runs, discover the nearest `.fazemos.json`
|
|
@@ -237,80 +241,14 @@ program
|
|
|
237
241
|
// them as in-memory overrides for the process. This scopes every call to the
|
|
238
242
|
// pinned org/project without a manual `orgs switch` / `projects switch`.
|
|
239
243
|
//
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
// BUG231-C1: resolution is no longer best-effort. An unresolvable or
|
|
245
|
+
// malformed pin hard-errors (exit 2, no API call) instead of silently
|
|
246
|
+
// falling back to the machine-global active org/project — see
|
|
247
|
+
// `applyDirContext` in `src/dircontext.ts` for the resolution/bypass order.
|
|
248
|
+
// This wrapper owns the only piece of state involved: the once-per-process
|
|
249
|
+
// latch (so a second `preAction` firing in the same process, e.g. a
|
|
250
|
+
// subcommand dispatch, doesn't re-resolve).
|
|
247
251
|
let dirContextApplied = false;
|
|
248
|
-
async function applyDirContext(topCommand) {
|
|
249
|
-
if (dirContextApplied)
|
|
250
|
-
return;
|
|
251
|
-
dirContextApplied = true;
|
|
252
|
-
let found;
|
|
253
|
-
try {
|
|
254
|
-
found = findDirContextFile();
|
|
255
|
-
}
|
|
256
|
-
catch (err) {
|
|
257
|
-
// Malformed .fazemos.json — surface it for normal commands, but don't
|
|
258
|
-
// abort. The bootstrap commands (notably `use`) report it themselves, so
|
|
259
|
-
// stay silent for them to avoid a double warning.
|
|
260
|
-
if (!DIR_CONTEXT_SKIP.has(topCommand))
|
|
261
|
-
console.error(chalk.yellow(err.message));
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
if (!found)
|
|
265
|
-
return;
|
|
266
|
-
// Record the source so whoami/config can show where the scope came from.
|
|
267
|
-
setDirContextSource({ path: found.path, ...found.context });
|
|
268
|
-
// Bootstrap commands (auth/env/init/use) operate without a resolved scope.
|
|
269
|
-
if (DIR_CONTEXT_SKIP.has(topCommand))
|
|
270
|
-
return;
|
|
271
|
-
const { org, project } = found.context;
|
|
272
|
-
if (org) {
|
|
273
|
-
try {
|
|
274
|
-
setOrgOverride(await resolveOrgIdMaybeSlug(org));
|
|
275
|
-
}
|
|
276
|
-
catch {
|
|
277
|
-
// Do NOT fail silently. Leaving the override unset means the command
|
|
278
|
-
// runs against whatever `orgs switch` last persisted machine-globally —
|
|
279
|
-
// for a READ the API error eventually hints at it, but for a WRITE the
|
|
280
|
-
// command simply SUCCEEDS IN THE WRONG ORG. Say so, on stderr, so the
|
|
281
|
-
// operator can see the scope they think they pinned was not applied.
|
|
282
|
-
console.error(chalk.yellow(`Warning: .fazemos.json pins org '${org}' but it could not be resolved ` +
|
|
283
|
-
`(offline, wrong --env, stale cache, or a typo'd slug). ` +
|
|
284
|
-
`Falling back to the machine-global active org — verify with 'fazemos whoami' before writing.`));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (project) {
|
|
288
|
-
try {
|
|
289
|
-
if (UUID_RE.test(project)) {
|
|
290
|
-
setProjectOverride(project);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
// Resolves against the active org, which now reflects the org override.
|
|
294
|
-
const projectId = await resolveProjectIdBySlug(project);
|
|
295
|
-
if (projectId) {
|
|
296
|
-
setProjectOverride(projectId);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
// Resolver MISS, not a throw — the old code fell through here in
|
|
300
|
-
// silence, which is how a pinned scope quietly became the global one.
|
|
301
|
-
console.error(chalk.yellow(`Warning: .fazemos.json pins project '${project}' but no such project ` +
|
|
302
|
-
`exists in the active org. Falling back to the machine-global active project.`));
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
catch {
|
|
307
|
-
// Same hazard as the org branch above — warn rather than silently
|
|
308
|
-
// inheriting the machine-global project.
|
|
309
|
-
console.error(chalk.yellow(`Warning: .fazemos.json pins project '${project}' but it could not be resolved. ` +
|
|
310
|
-
`Falling back to the machine-global active project — verify with 'fazemos whoami' before writing.`));
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
252
|
program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
315
253
|
// Apply the global `--env` flag first so every downstream resolution (dir
|
|
316
254
|
// context slug lookups, auth, API calls) sees the right environment.
|
|
@@ -324,7 +262,26 @@ program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
|
324
262
|
c = c.parent;
|
|
325
263
|
top = c.name();
|
|
326
264
|
}
|
|
327
|
-
|
|
265
|
+
if (dirContextApplied)
|
|
266
|
+
return;
|
|
267
|
+
dirContextApplied = true;
|
|
268
|
+
// Deps are wrapped in closures (not passed by reference) so that a test's
|
|
269
|
+
// `./api.js`/`./config.js` mock only needs to provide the specific
|
|
270
|
+
// resolver a given command path actually exercises — same laziness the
|
|
271
|
+
// pre-extraction code had, since these named imports are otherwise
|
|
272
|
+
// referenced all over index.ts for unrelated commands.
|
|
273
|
+
await applyDirContext(top ?? '', actionCommand.opts(), {
|
|
274
|
+
resolveOrgIdMaybeSlug: (value) => resolveOrgIdMaybeSlug(value),
|
|
275
|
+
resolveProjectIdBySlug: (slug) => resolveProjectIdBySlug(slug),
|
|
276
|
+
setOrgOverride: (orgId) => setOrgOverride(orgId),
|
|
277
|
+
setProjectOverride: (projectId) => setProjectOverride(projectId),
|
|
278
|
+
setDirContextSource: (source) => setDirContextSource(source),
|
|
279
|
+
exit: (code) => process.exit(code),
|
|
280
|
+
env: process.env,
|
|
281
|
+
stderr: (message) => console.error(chalk.red(message)),
|
|
282
|
+
isAgentCredential: () => isAgentCredential(),
|
|
283
|
+
fetchCredentialScope: () => fetchCredentialScope(),
|
|
284
|
+
});
|
|
328
285
|
});
|
|
329
286
|
// ── Init ────────────────────────────────────────────────────
|
|
330
287
|
program
|
|
@@ -542,9 +499,39 @@ auth
|
|
|
542
499
|
// ── Whoami ──────────────────────────────────────────────────
|
|
543
500
|
program
|
|
544
501
|
.command('whoami')
|
|
545
|
-
.description('Show current user, org, and project context.
|
|
502
|
+
.description('Show current user, org, and project context. Human callers use their Cognito identity (JWT); agent callers (FAZEMOS_API_KEY set) use `/api/members/me` instead, since `/auth/me` 403s for them.')
|
|
546
503
|
.action(async () => {
|
|
547
504
|
try {
|
|
505
|
+
// BUG231-C1a S6: agent credentials 403 on /auth/me
|
|
506
|
+
// (WRONG_ENDPOINT_FOR_AGENT) — use /api/members/me instead, and show
|
|
507
|
+
// the dirContextSource `verified` marker so an operator can tell a
|
|
508
|
+
// credential-confirmed pin from one the CLI merely proceeded on.
|
|
509
|
+
if (isAgentCredential()) {
|
|
510
|
+
const me = (await api('GET', '/api/members/me', undefined, { noProjectHeader: true }));
|
|
511
|
+
console.log(` Member: ${chalk.cyan(me.member.display_name)} (${me.member.role}) [agent credential]`);
|
|
512
|
+
console.log(` Env: ${chalk.cyan(getActiveEnvName())}`);
|
|
513
|
+
console.log(` Org: ${me.member.org_id}`);
|
|
514
|
+
if (me.project) {
|
|
515
|
+
console.log(` Project: ${chalk.cyan(me.project.name)} (${me.project.slug})`);
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
console.log(` Project: ${chalk.gray('(org-level credential — no project scope)')}`);
|
|
519
|
+
}
|
|
520
|
+
const dirSource = getDirContextSource();
|
|
521
|
+
if (dirSource) {
|
|
522
|
+
const rel = relative(process.cwd(), dirSource.path) || dirSource.path;
|
|
523
|
+
if (dirSource.ignored) {
|
|
524
|
+
console.log(chalk.gray(` Scope: pin at ${rel} IGNORED (FAZEMOS_IGNORE_DIR_CONTEXT=1)`));
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
const verifiedLabel = dirSource.verified
|
|
528
|
+
? chalk.gray(` [verified: ${dirSource.verified}]`)
|
|
529
|
+
: '';
|
|
530
|
+
console.log(chalk.gray(` Scope: from ${rel} (fazemos use)`) + verifiedLabel);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
548
535
|
// Force-refresh the /auth/me cache on whoami so subsequent slug
|
|
549
536
|
// resolutions (e.g., `projects switch vahmos`) see the fresh state
|
|
550
537
|
// without a second round-trip.
|
|
@@ -592,10 +579,17 @@ program
|
|
|
592
579
|
}
|
|
593
580
|
// Note when the org/project scope is coming from a directory .fazemos.json
|
|
594
581
|
// rather than the persisted active selection, so the source is obvious.
|
|
582
|
+
// BUG231-C1 S4: FAZEMOS_IGNORE_DIR_CONTEXT=1 sees the pin but doesn't
|
|
583
|
+
// apply it — say so explicitly rather than implying it was applied.
|
|
595
584
|
const dirSource = getDirContextSource();
|
|
596
585
|
if (dirSource) {
|
|
597
586
|
const rel = relative(process.cwd(), dirSource.path) || dirSource.path;
|
|
598
|
-
|
|
587
|
+
if (dirSource.ignored) {
|
|
588
|
+
console.log(chalk.gray(` Scope: pin at ${rel} IGNORED (FAZEMOS_IGNORE_DIR_CONTEXT=1)`));
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
console.log(chalk.gray(` Scope: from ${rel} (fazemos use)`));
|
|
592
|
+
}
|
|
599
593
|
}
|
|
600
594
|
}
|
|
601
595
|
catch (err) {
|
|
@@ -1664,14 +1658,14 @@ projects
|
|
|
1664
1658
|
if (p.docsRepoSource === 'project') {
|
|
1665
1659
|
// Variant A — docs_repo set directly on this project
|
|
1666
1660
|
console.log(` Docs repository: ${p.effectiveDocsRepo} ${chalk.gray('(set for this project)')}`);
|
|
1667
|
-
const docsRoot = p.docsRoot
|
|
1668
|
-
console.log(` Docs root: ${docsRoot}
|
|
1661
|
+
const docsRoot = p.docsRoot === null ? 'ROOT (repo root)' : p.docsRoot;
|
|
1662
|
+
console.log(` Docs root: ${docsRoot}`);
|
|
1669
1663
|
}
|
|
1670
1664
|
else if (p.docsRepoSource === 'org') {
|
|
1671
1665
|
// Variant B — inheriting from org workspace_repo
|
|
1672
1666
|
console.log(` Docs repository: ${p.effectiveDocsRepo} ${chalk.gray('(inherited from org)')}`);
|
|
1673
|
-
const docsRoot = p.docsRoot
|
|
1674
|
-
console.log(` Docs root: ${docsRoot}
|
|
1667
|
+
const docsRoot = p.docsRoot === null ? 'ROOT (repo root)' : p.docsRoot;
|
|
1668
|
+
console.log(` Docs root: ${docsRoot}`);
|
|
1675
1669
|
console.log(chalk.gray(` → change with: fazemos projects set-docs-repo <owner/repo>`));
|
|
1676
1670
|
}
|
|
1677
1671
|
else {
|
|
@@ -1982,8 +1976,8 @@ projects
|
|
|
1982
1976
|
// Sage Screen 6 — set path
|
|
1983
1977
|
console.log(chalk.green(`✓ Docs repo set for ${p.name} (${p.slug})`));
|
|
1984
1978
|
console.log(` Docs repository: ${docsRepo} ${chalk.gray('(set for this project)')}`);
|
|
1985
|
-
const docsRoot = p.docsRoot
|
|
1986
|
-
console.log(` Docs root: ${docsRoot}
|
|
1979
|
+
const docsRoot = p.docsRoot === null ? 'ROOT (repo root)' : p.docsRoot;
|
|
1980
|
+
console.log(` Docs root: ${docsRoot}`);
|
|
1987
1981
|
console.log(chalk.gray(' Reachability is tested when a pipeline first tries to clone the repo.'));
|
|
1988
1982
|
console.log(chalk.gray(' If it can\'t be reached, we\'ll point you back here.'));
|
|
1989
1983
|
}
|
|
@@ -2136,7 +2130,12 @@ projects
|
|
|
2136
2130
|
if (unchangedFields.length > 0) {
|
|
2137
2131
|
console.log(chalk.gray(` (unchanged: ${unchangedFields.join(', ')})`));
|
|
2138
2132
|
}
|
|
2139
|
-
|
|
2133
|
+
if (data.auditLogId) {
|
|
2134
|
+
console.log(` Audit: logged as project_setup (id: ${data.auditLogId})`);
|
|
2135
|
+
}
|
|
2136
|
+
else {
|
|
2137
|
+
console.log(chalk.gray(` Audit: no changes detected — audit row skipped`));
|
|
2138
|
+
}
|
|
2140
2139
|
}
|
|
2141
2140
|
catch (err) {
|
|
2142
2141
|
if (opts.json) {
|
|
@@ -10273,6 +10272,31 @@ Types: question | task | signal | response | flag | decision | direction | brief
|
|
|
10273
10272
|
// Resolve recipient
|
|
10274
10273
|
// rul_dispatch_cli_fallthrough_on_local_unresolved
|
|
10275
10274
|
const resolved = resolveRole(to, localRegistry);
|
|
10275
|
+
// BUG221 lever-a (AC-3): env-unresolvable pre-flight.
|
|
10276
|
+
// Detect a misconfigured FAZEMOS_ENV BEFORE any API call so the CLI
|
|
10277
|
+
// exits loudly (code 3) instead of silently degrading to file-only.
|
|
10278
|
+
// The unresolved path ALWAYS calls the API; the resolved path calls it
|
|
10279
|
+
// unless --file-only is set. Skip only when resolved + --file-only
|
|
10280
|
+
// (no API call will be made in that branch).
|
|
10281
|
+
if (!resolved || !opts.fileOnly) {
|
|
10282
|
+
try {
|
|
10283
|
+
getEnv();
|
|
10284
|
+
}
|
|
10285
|
+
catch {
|
|
10286
|
+
const envName = getActiveEnvName();
|
|
10287
|
+
console.error(`fazemos dispatch: FAZEMOS_ENV="${envName}" is not configured; nothing sent. Set env or use --file-only to force a local dead-letter.`);
|
|
10288
|
+
process.exitCode = 3;
|
|
10289
|
+
return;
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
// BUG221 lever-a (AC-4): wake-ineligible type to cadenceless target pre-flight.
|
|
10293
|
+
// Applies only to resolved roles (unresolved roles have no local cadence data).
|
|
10294
|
+
// Refuses BEFORE any API call — no file written, no network call.
|
|
10295
|
+
if (resolved && !opts.fileOnly && isWakeIneligibleForCadencelessRole(type, resolved.role.cadence_schedule)) {
|
|
10296
|
+
console.error(`fazemos dispatch: role "${to}" has no drain cadence and type "${type}" does not fire a wake; nothing sent. Use type=task or type=question, or fix the role's cadence, or use --file-only.`);
|
|
10297
|
+
process.exitCode = 4;
|
|
10298
|
+
return;
|
|
10299
|
+
}
|
|
10276
10300
|
if (!resolved) {
|
|
10277
10301
|
// Registry-less path: recipient not found in local workspace registry
|
|
10278
10302
|
// (e.g. cross-workspace human role like `founder` in a peer workspace).
|
|
@@ -10317,9 +10341,16 @@ Types: question | task | signal | response | flag | decision | direction | brief
|
|
|
10317
10341
|
process.exitCode = 1;
|
|
10318
10342
|
return;
|
|
10319
10343
|
}
|
|
10320
|
-
//
|
|
10321
|
-
// rul_dispatch_local_file_best_effort_cross_workspace
|
|
10322
|
-
|
|
10344
|
+
// BUG221 lever-a (AC-2b): transient network failure in registry-less path.
|
|
10345
|
+
// rul_dispatch_local_file_best_effort_cross_workspace: NO file write —
|
|
10346
|
+
// there is no role.inbox because the recipient is not in this workspace's
|
|
10347
|
+
// registry. Exit 2 (non-zero) so downstream tooling sees the failure loudly.
|
|
10348
|
+
const networkMsg = err instanceof Error ? err.message : String(err);
|
|
10349
|
+
const apiUrl = getEnv().apiUrl;
|
|
10350
|
+
console.error(`fazemos dispatch: API unreachable at ${apiUrl} after network error; recipient '${to}' is not in this workspace's registry and cannot be file-mirrored locally. Nothing sent.`);
|
|
10351
|
+
console.error(` Error: ${networkMsg}`);
|
|
10352
|
+
process.exitCode = 2;
|
|
10353
|
+
return;
|
|
10323
10354
|
}
|
|
10324
10355
|
// 2xx — server resolved the recipient. Print UX §4.4 stdout copy verbatim.
|
|
10325
10356
|
// rul_dispatch_local_file_best_effort_cross_workspace
|
|
@@ -10404,24 +10435,28 @@ Types: question | task | signal | response | flag | decision | direction | brief
|
|
|
10404
10435
|
process.exitCode = 1;
|
|
10405
10436
|
return;
|
|
10406
10437
|
}
|
|
10407
|
-
//
|
|
10408
|
-
|
|
10409
|
-
|
|
10438
|
+
// BUG221 lever-a (AC-2): transient network failure in resolved path.
|
|
10439
|
+
// Write a file-only fallback (role.inbox is available) AND exit 2 (non-zero).
|
|
10440
|
+
// The operator is told the file was written and drain-on-cadence is the recovery
|
|
10441
|
+
// path. This replaces the old silent exit-0 — downstream tooling now sees failure.
|
|
10442
|
+
const networkMsg = err instanceof Error ? err.message : String(err);
|
|
10443
|
+
const apiUrl = getEnv().apiUrl;
|
|
10410
10444
|
fullPath = writeInboxFile(registry._workspaceRoot, role, filename, content);
|
|
10411
10445
|
relPath = fullPath.startsWith(registry._workspaceRoot)
|
|
10412
10446
|
? fullPath.slice(registry._workspaceRoot.length + 1)
|
|
10413
10447
|
: fullPath;
|
|
10414
|
-
console.
|
|
10415
|
-
console.
|
|
10448
|
+
console.error(`fazemos dispatch: API unreachable at ${apiUrl} after network error; wrote file-only fallback at ${fullPath}. Recipient will drain on next cadence tick.`);
|
|
10449
|
+
console.error(` Error: ${networkMsg}`);
|
|
10416
10450
|
if (opts.commit) {
|
|
10417
10451
|
try {
|
|
10418
10452
|
gitCommitInboxFile(registry._workspaceRoot, relPath, `dispatch(${opts.from} → ${to}): ${type}`);
|
|
10419
|
-
console.
|
|
10453
|
+
console.error(' File committed.');
|
|
10420
10454
|
}
|
|
10421
10455
|
catch (cerr) {
|
|
10422
|
-
console.
|
|
10456
|
+
console.error(` warning: commit failed — ${cerr instanceof Error ? cerr.message : String(cerr)}`);
|
|
10423
10457
|
}
|
|
10424
10458
|
}
|
|
10459
|
+
process.exitCode = 2;
|
|
10425
10460
|
return;
|
|
10426
10461
|
}
|
|
10427
10462
|
// API returned file_path — CLI writes the actual file (Dex S-B).
|
|
@@ -10952,6 +10987,16 @@ registerIngestCommands(program);
|
|
|
10952
10987
|
// put: idempotent by content hash; retries once on 403 from S3 (expired presigned URL).
|
|
10953
10988
|
// show: warns on silent-canary state (s3_object_exists=false + committed + permanent).
|
|
10954
10989
|
registerAssetCommands(program);
|
|
10990
|
+
// ── F70 — Floor Projection: fazemos floor summary/status/--json ──────────────
|
|
10991
|
+
// Registers `floor` top-level command with `summary` and `status` sub-commands.
|
|
10992
|
+
// GET /api/floor/summary[?projectId=<uuid>] — read-only org-scoped projection.
|
|
10993
|
+
// Scoping: ?projectId query param (not X-Fazemos-Project-Id header).
|
|
10994
|
+
// --project <slug> resolve slug → uuid, pass ?projectId=<uuid>
|
|
10995
|
+
// --all-projects no ?projectId (org-wide)
|
|
10996
|
+
// (default) active project if set, otherwise org-wide
|
|
10997
|
+
// Requires pipelines:read scope (same as work-queue/summary precedent).
|
|
10998
|
+
// Top-level --json is sugar for `floor summary --json`.
|
|
10999
|
+
registerFloorCommands(program);
|
|
10955
11000
|
// Skip auto-parse only when running under Vitest (which sets process.env.VITEST).
|
|
10956
11001
|
// Tests import `program` and drive it via `program.parseAsync(...)` after mocking
|
|
10957
11002
|
// `./api.js`. In every other context — direct invocation, npx tsx, OR the bin
|