@formigio/fazemos-cli 0.10.62 → 0.10.64

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 CHANGED
@@ -118,3 +118,26 @@ export declare function api(method: string, path: string, body?: unknown, opts?:
118
118
  * handlers to keep the next slug-resolution honest.
119
119
  */
120
120
  export declare function invalidateAuthMeCache(): void;
121
+ /**
122
+ * F18-FU T-CLI-1 — Set or clear a project's docs_repo field.
123
+ *
124
+ * Calls PATCH /api/organizations/:orgId/projects/:projectId with
125
+ * { docsRepo, reason }. Pass `null` for docsRepo to clear the field (the
126
+ * project then inherits from org.workspace_repo at runtime).
127
+ */
128
+ export declare function patchProjectDocsRepo(orgId: string, projectId: string, body: {
129
+ docsRepo: string | null;
130
+ reason?: string;
131
+ }): Promise<unknown>;
132
+ /**
133
+ * F18-FU T-CLI-2 — Set or clear the org-level workspace_repo + workspace_branch.
134
+ *
135
+ * Calls PATCH /api/organizations/:orgId. The API accepts snake_case keys for
136
+ * workspace_repo and workspace_branch (F18 shipped this shape; do not reshape).
137
+ * Pass `null` for workspace_repo to clear the field.
138
+ */
139
+ export declare function patchOrgWorkspace(orgId: string, body: {
140
+ workspace_repo: string | null;
141
+ workspace_branch?: string;
142
+ reason?: string;
143
+ }): Promise<unknown>;
package/dist/api.js CHANGED
@@ -257,4 +257,25 @@ export async function api(method, path, body, opts = {}) {
257
257
  export function invalidateAuthMeCache() {
258
258
  clearAuthMeCache();
259
259
  }
260
+ // ── F18-FU named helpers for docs-repo settings ─────────────────────────────
261
+ /**
262
+ * F18-FU T-CLI-1 — Set or clear a project's docs_repo field.
263
+ *
264
+ * Calls PATCH /api/organizations/:orgId/projects/:projectId with
265
+ * { docsRepo, reason }. Pass `null` for docsRepo to clear the field (the
266
+ * project then inherits from org.workspace_repo at runtime).
267
+ */
268
+ export async function patchProjectDocsRepo(orgId, projectId, body) {
269
+ return api('PATCH', `/api/organizations/${orgId}/projects/${projectId}`, body, { noProjectHeader: true });
270
+ }
271
+ /**
272
+ * F18-FU T-CLI-2 — Set or clear the org-level workspace_repo + workspace_branch.
273
+ *
274
+ * Calls PATCH /api/organizations/:orgId. The API accepts snake_case keys for
275
+ * workspace_repo and workspace_branch (F18 shipped this shape; do not reshape).
276
+ * Pass `null` for workspace_repo to clear the field.
277
+ */
278
+ export async function patchOrgWorkspace(orgId, body) {
279
+ return api('PATCH', `/api/organizations/${orgId}`, body, { noProjectHeader: true });
280
+ }
260
281
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,cAAc,EACd,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAU;IACd,IAAI,CAAW;IACf,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa,EAAE,IAAc;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AA4BD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,YAAqB;IAChE,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,IAAI,YAAY,EAAE,CAAC;QACjB,IAAI,OAAO,GAAG,iBAAiB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AAG,EAAE,KAAK,IAAI,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEpD,+DAA+D;QAC/D,8DAA8D;QAC9D,IAAI,IAAI,KAAK,yBAAyB,EAAE,CAAC;YACvC,MAAM,IAAI,QAAQ,CAChB,8BAA8B,EAC9B,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,IAAI,CACL,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,gBAAgB,EAAE,CAAC;AACrB,CAAC;AAED,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAa,EACb,SAAiB,EACjB,IAAkD;IAElD,OAAO,GAAG,CACR,OAAO,EACP,sBAAsB,KAAK,aAAa,SAAS,EAAE,EACnD,IAAI,EACJ,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAa,EACb,IAAmF;IAEnF,OAAO,GAAG,CACR,OAAO,EACP,sBAAsB,KAAK,EAAE,EAC7B,IAAI,EACJ,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAC;AACJ,CAAC"}
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ getActiveProjectId, setActiveProjectId, clearActiveProjectId, findProjectBySlug,
8
8
  setOrgOverride, setProjectOverride, setDirContextSource, getDirContextSource, } from './config.js';
9
9
  import { findDirContextFile, readDirContextFile, writeDirContextFile, removeDirContextFile, DIR_CONFIG_FILENAME, } from './dircontext.js';
10
10
  import { login, signup, confirmSignup, adminLogin } from './auth.js';
11
- import { api, ApiError, refreshAuthMeCache, invalidateAuthMeCache, resolveOrgIdMaybeSlug, resolveProjectIdBySlug } from './api.js';
11
+ import { api, ApiError, refreshAuthMeCache, invalidateAuthMeCache, resolveOrgIdMaybeSlug, resolveProjectIdBySlug, patchProjectDocsRepo, patchOrgWorkspace } from './api.js';
12
12
  import { isProjectConnectionUnavailable, renderProjectConnectionUnavailableCopy, } from './connectionErrorCopy.js';
13
13
  import { loadYaml, summarize } from './yaml/load.js';
14
14
  import { printFindings, printJson } from './yaml/format.js';
@@ -761,6 +761,83 @@ orgs
761
761
  process.exit(1);
762
762
  }
763
763
  });
764
+ // ── F18-FU — orgs set-workspace ─────────────────────────────────────────────
765
+ orgs
766
+ .command('set-workspace')
767
+ .description('Set or clear the org-level workspace repository and branch. Owner/admin only.\n\n' +
768
+ 'Pass <owner/repo> to set the fallback docs repo for all projects that have not\n' +
769
+ 'configured their own docs repo. Use --clear to remove the org-level repo.\n\n' +
770
+ 'Note: this uses PATCH /api/organizations/:orgId (not PUT). Format validation\n' +
771
+ 'is enforced on save; reachability is checked at pipeline-run time.')
772
+ .argument('[owner/repo]', 'Repository in owner/repo format (e.g. formigio/fazemos-workspace)')
773
+ .option('--branch <name>', 'Branch name (default: main)', 'main')
774
+ .option('--clear', 'Clear the org-level workspace repo')
775
+ .option('--reason <text>', 'Optional reason recorded in the audit log')
776
+ .action(async (repo, opts) => {
777
+ try {
778
+ // Validate mutual exclusion
779
+ if (!repo && !opts.clear) {
780
+ console.error(chalk.red('Provide <owner/repo> or --clear'));
781
+ console.log(chalk.gray('Usage: fazemos orgs set-workspace <owner/repo> [--branch <name>]'));
782
+ console.log(chalk.gray(' fazemos orgs set-workspace --clear'));
783
+ process.exit(1);
784
+ }
785
+ if (repo && opts.clear) {
786
+ console.error(chalk.red('<owner/repo> and --clear are mutually exclusive'));
787
+ process.exit(1);
788
+ }
789
+ const orgId = getActiveOrgId();
790
+ if (!orgId) {
791
+ console.error(chalk.red('No active org. Run: fazemos orgs switch <slug>'));
792
+ process.exit(1);
793
+ }
794
+ const workspace_repo = opts.clear ? null : repo;
795
+ const body = {
796
+ workspace_repo,
797
+ };
798
+ if (!opts.clear) {
799
+ // Only send workspace_branch when setting a repo (not clearing)
800
+ body.workspace_branch = opts.branch;
801
+ }
802
+ if (opts.reason)
803
+ body.reason = opts.reason;
804
+ const data = await patchOrgWorkspace(orgId, body);
805
+ const org = data.organization;
806
+ if (workspace_repo === null) {
807
+ console.log(chalk.green(`✓ Org workspace repo cleared for ${org.name ?? org.slug}`));
808
+ console.log(chalk.yellow(' ⚠ Projects without a project-level docs repo will now have no effective repo — pipelines will fail to clone.'));
809
+ console.log(chalk.gray(' → set a project-level repo: fazemos projects set-docs-repo <owner/repo>'));
810
+ }
811
+ else {
812
+ console.log(chalk.green(`✓ Org workspace set for ${org.name ?? org.slug}`));
813
+ console.log(` Workspace repo: ${workspace_repo}`);
814
+ console.log(` Branch: ${opts.branch}`);
815
+ console.log(chalk.gray(' New projects will inherit this. To override per-project: fazemos projects set-docs-repo <owner/repo>'));
816
+ }
817
+ }
818
+ catch (err) {
819
+ if (err instanceof ApiError) {
820
+ if (err.code === 'workspace_repo_format_invalid') {
821
+ console.error(chalk.red('Invalid repo format. Expected owner/repo (e.g. formigio/fazemos-workspace).'));
822
+ process.exit(1);
823
+ }
824
+ if (err.code === 'workspace_repo_empty') {
825
+ console.error(chalk.red('Workspace repo cannot be an empty string. Use --clear to remove it.'));
826
+ process.exit(1);
827
+ }
828
+ if (err.code === 'workspace_branch_empty') {
829
+ console.error(chalk.red('Branch name cannot be empty.'));
830
+ process.exit(1);
831
+ }
832
+ if (err.code === 'workspace_branch_invalid') {
833
+ console.error(chalk.red('Branch name is too long (max 100 characters).'));
834
+ process.exit(1);
835
+ }
836
+ }
837
+ console.error(chalk.red(err.message));
838
+ process.exit(1);
839
+ }
840
+ });
764
841
  orgs
765
842
  .command('invite')
766
843
  .description('Invite a human member to the organization by email. The invitee receives an email with a one-time link to join. Use "orgs add-agent" for AI agents instead.')
@@ -1507,6 +1584,32 @@ projects
1507
1584
  console.log(` Created: ${p.createdAt ? new Date(p.createdAt).toLocaleString() : '(unknown)'}`);
1508
1585
  if (p.archivedAt)
1509
1586
  console.log(` Archived at: ${new Date(p.archivedAt).toLocaleString()}`);
1587
+ // F18-FU T-CLI-3 — Docs repository output (Sage Screen 5 copy verbatim).
1588
+ // effectiveDocsRepo + docsRepoSource are server-computed fields on the
1589
+ // enriched GET .../projects/:projectId response — the CLI never computes
1590
+ // them locally.
1591
+ console.log('');
1592
+ console.log(chalk.cyan('Docs:'));
1593
+ if (p.docsRepoSource === 'project') {
1594
+ // Variant A — docs_repo set directly on this project
1595
+ console.log(` Docs repository: ${p.effectiveDocsRepo} ${chalk.gray('(set for this project)')}`);
1596
+ const docsRoot = p.docsRoot ?? `projects/${p.slug}`;
1597
+ console.log(` Docs root: ${docsRoot} ${chalk.gray('(convention default)')}`);
1598
+ }
1599
+ else if (p.docsRepoSource === 'org') {
1600
+ // Variant B — inheriting from org workspace_repo
1601
+ console.log(` Docs repository: ${p.effectiveDocsRepo} ${chalk.gray('(inherited from org)')}`);
1602
+ const docsRoot = p.docsRoot ?? `projects/${p.slug}`;
1603
+ console.log(` Docs root: ${docsRoot} ${chalk.gray('(convention default)')}`);
1604
+ console.log(chalk.gray(` → change with: fazemos projects set-docs-repo <owner/repo>`));
1605
+ }
1606
+ else {
1607
+ // Variant C — neither project nor org has a docs repo configured
1608
+ console.log(` Docs repository: ${chalk.yellow('⚠ not configured')}`);
1609
+ console.log(chalk.yellow(' Pipelines will fail to clone until this is set.'));
1610
+ console.log(chalk.gray(` → set for this project: fazemos projects set-docs-repo ${p.slug} <owner/repo>`));
1611
+ console.log(chalk.gray(` → set at org level: fazemos orgs set-workspace <owner/repo>`));
1612
+ }
1510
1613
  if (p.stats) {
1511
1614
  console.log('');
1512
1615
  console.log(chalk.cyan('Activity:'));
@@ -1751,6 +1854,84 @@ projects
1751
1854
  process.exit(1);
1752
1855
  }
1753
1856
  });
1857
+ // ── F18-FU — projects set-docs-repo ─────────────────────────────────────────
1858
+ projects
1859
+ .command('set-docs-repo')
1860
+ .description('Set or clear the docs repository for a project. Owner/admin only.\n\n' +
1861
+ 'Pass <owner/repo> to point the project at a specific GitHub repo.\n' +
1862
+ 'Pass --clear to remove the project-level override (the project then inherits\n' +
1863
+ 'the org workspace_repo, or pipelines fail if that is also unset).\n\n' +
1864
+ 'Format validation is enforced on save. Reachability is tested at pipeline-run\n' +
1865
+ 'time — if the repo can\'t be cloned, check Project Settings → Docs.')
1866
+ .argument('[owner/repo]', 'Repository in owner/repo format (e.g. formigio/fazemos-workspace)')
1867
+ .option('--clear', 'Clear the project-level docs repo (reverts to org-level fallback)')
1868
+ .option('--reason <text>', 'Optional reason recorded in the audit log')
1869
+ .action(async (repo, opts) => {
1870
+ try {
1871
+ // Validate mutual exclusion: need exactly one of <owner/repo> or --clear
1872
+ if (!repo && !opts.clear) {
1873
+ console.error(chalk.red('Provide <owner/repo> or --clear'));
1874
+ console.log(chalk.gray('Usage: fazemos projects set-docs-repo <owner/repo>'));
1875
+ console.log(chalk.gray(' fazemos projects set-docs-repo --clear'));
1876
+ process.exit(1);
1877
+ }
1878
+ if (repo && opts.clear) {
1879
+ console.error(chalk.red('<owner/repo> and --clear are mutually exclusive'));
1880
+ process.exit(1);
1881
+ }
1882
+ const orgId = requireActiveOrgOrExit();
1883
+ // Resolve slug -> id; the active project is required for this command.
1884
+ // We don't accept a <slug> argument here — this command acts on the
1885
+ // active project (or --project override from the global hook). If no
1886
+ // project is active, fail clearly.
1887
+ const projectId = await resolveProjectIdBySlug();
1888
+ if (!projectId) {
1889
+ console.error(chalk.red('No active project. Run: fazemos projects switch <slug>'));
1890
+ process.exit(1);
1891
+ }
1892
+ const docsRepo = opts.clear ? null : repo;
1893
+ const body = { docsRepo };
1894
+ if (opts.reason)
1895
+ body.reason = opts.reason;
1896
+ const data = await patchProjectDocsRepo(orgId, projectId, body);
1897
+ const p = data.project;
1898
+ if (docsRepo === null) {
1899
+ // Sage Screen 6 — clear path
1900
+ if (p.effectiveDocsRepo) {
1901
+ console.log(chalk.green(`✓ Docs repo cleared for ${p.name} (${p.slug})`));
1902
+ console.log(chalk.gray(` Now inheriting: ${p.effectiveDocsRepo} (from org)`));
1903
+ }
1904
+ else {
1905
+ console.log(chalk.green(`✓ Docs repo cleared for ${p.name} (${p.slug})`));
1906
+ console.log(chalk.yellow(' ⚠ No org-level workspace repo set either — pipelines will fail to clone until one is configured.'));
1907
+ console.log(chalk.gray(` → set at org level: fazemos orgs set-workspace <owner/repo>`));
1908
+ }
1909
+ }
1910
+ else {
1911
+ // Sage Screen 6 — set path
1912
+ console.log(chalk.green(`✓ Docs repo set for ${p.name} (${p.slug})`));
1913
+ console.log(` Docs repository: ${docsRepo} ${chalk.gray('(set for this project)')}`);
1914
+ const docsRoot = p.docsRoot ?? `projects/${p.slug}`;
1915
+ console.log(` Docs root: ${docsRoot} ${chalk.gray('(convention default)')}`);
1916
+ console.log(chalk.gray(' Reachability is tested when a pipeline first tries to clone the repo.'));
1917
+ console.log(chalk.gray(' If it can\'t be reached, we\'ll point you back here.'));
1918
+ }
1919
+ }
1920
+ catch (err) {
1921
+ if (err instanceof ApiError) {
1922
+ if (err.code === 'docs_repo_format_invalid') {
1923
+ console.error(chalk.red('Invalid repo format. Expected owner/repo (e.g. formigio/fazemos-workspace).'));
1924
+ process.exit(1);
1925
+ }
1926
+ if (err.code === 'docs_repo_empty') {
1927
+ console.error(chalk.red('Docs repo cannot be an empty string. Use --clear to remove it.'));
1928
+ process.exit(1);
1929
+ }
1930
+ }
1931
+ console.error(chalk.red(err.message));
1932
+ process.exit(1);
1933
+ }
1934
+ });
1754
1935
  // ── F42 — projects setup (binds docs + connection in one call) ──────────────
1755
1936
  projects
1756
1937
  .command('setup')