@warmhub/cli 0.80.0 → 0.81.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.
Files changed (2) hide show
  1. package/dist/wh.js +142 -17
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -19201,11 +19201,16 @@ var isStoredContentName = (n) => STORED_CONTENT_NAMES.includes(n);
19201
19201
  var isSynthesizedContentName = (n) => SYNTHESIZED_CONTENT_NAMES.includes(n);
19202
19202
  var BUILTIN_VIEW_SHAPE_NAMES = ["View"];
19203
19203
  var isViewShape = (name) => BUILTIN_VIEW_SHAPE_NAMES.includes(name);
19204
+ var BUILTIN_LICENSE_SHAPE_NAMES = [
19205
+ "LicenseSubject",
19206
+ "LicenseDeclaration"
19207
+ ];
19208
+ var isLicenseShape = (name) => BUILTIN_LICENSE_SHAPE_NAMES.includes(name);
19204
19209
  function isRenameableSquattedShape(name) {
19205
- return isReservedCollectionShape(name) || isViewShape(name);
19210
+ return isReservedCollectionShape(name) || isViewShape(name) || isLicenseShape(name);
19206
19211
  }
19207
19212
  function isBuiltinShape(name) {
19208
- return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name) || BUILTIN_VIEW_SHAPE_NAMES.includes(name);
19213
+ return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name) || BUILTIN_VIEW_SHAPE_NAMES.includes(name) || BUILTIN_LICENSE_SHAPE_NAMES.includes(name);
19209
19214
  }
19210
19215
  var BUILTIN_SHAPE_DEFS = {
19211
19216
  Arc: {
@@ -19271,10 +19276,63 @@ var BUILTIN_VIEW_SHAPE_DEFS = {
19271
19276
  description: "A named, shareable WarmQuery definition bound to durable IDs"
19272
19277
  }
19273
19278
  };
19279
+ var BUILTIN_LICENSE_SHAPE_DEFS = {
19280
+ LicenseSubject: {
19281
+ fields: {
19282
+ scope: {
19283
+ type: "string",
19284
+ description: "What portion of the repository is being licensed"
19285
+ },
19286
+ "note?": {
19287
+ type: "string",
19288
+ description: "Optional clarification of the licensed scope"
19289
+ }
19290
+ },
19291
+ description: "A licensable body of work in this repository"
19292
+ },
19293
+ LicenseDeclaration: {
19294
+ fields: {
19295
+ "licenseWref?": {
19296
+ type: "wref",
19297
+ description: "Canonical license reference when one license applies"
19298
+ },
19299
+ spdxIdRaw: {
19300
+ type: "string",
19301
+ description: "Declared SPDX identifier or raw license value"
19302
+ },
19303
+ "spdxExpression?": {
19304
+ type: "string",
19305
+ description: "Full SPDX expression for compound declarations"
19306
+ },
19307
+ "appliesTo?": {
19308
+ type: "string",
19309
+ description: "Kind of work covered by the declaration"
19310
+ },
19311
+ "attributionText?": {
19312
+ type: "string",
19313
+ description: "Attribution text reusers should preserve"
19314
+ },
19315
+ "declaredBy?": {
19316
+ type: "string",
19317
+ description: "Person or organization making the declaration"
19318
+ },
19319
+ "sourceUrl?": {
19320
+ type: "string",
19321
+ description: "Upstream source for the licensing terms"
19322
+ },
19323
+ "note?": {
19324
+ type: "string",
19325
+ description: "Optional declaration caveats or clarification"
19326
+ }
19327
+ },
19328
+ description: "Declares the license of a LicenseSubject"
19329
+ }
19330
+ };
19274
19331
  var ALL_BUILTIN_SHAPE_DEFS = {
19275
19332
  ...BUILTIN_SHAPE_DEFS,
19276
19333
  ...BUILTIN_CONTENT_SHAPE_DEFS,
19277
- ...BUILTIN_VIEW_SHAPE_DEFS
19334
+ ...BUILTIN_VIEW_SHAPE_DEFS,
19335
+ ...BUILTIN_LICENSE_SHAPE_DEFS
19278
19336
  };
19279
19337
  // ../../packages/rules/src/client-header.ts
19280
19338
  var CLIENT_HEADER = "X-WarmHub-Client";
@@ -28477,7 +28535,7 @@ function dedupeDeprecationsByShape(results) {
28477
28535
  // ../../packages/sdk-ts/package.json
28478
28536
  var package_default = {
28479
28537
  name: "@warmhub/sdk-ts",
28480
- version: "0.78.0",
28538
+ version: "0.79.0",
28481
28539
  private: false,
28482
28540
  type: "module",
28483
28541
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -29623,6 +29681,26 @@ class WarmHubClient {
29623
29681
  throw toWarmHubError(error);
29624
29682
  }
29625
29683
  },
29684
+ getLicense: async (orgName, repoName) => {
29685
+ try {
29686
+ return await this.trpc.repo.getLicense.query({
29687
+ orgName,
29688
+ repoName
29689
+ });
29690
+ } catch (error) {
29691
+ throw toWarmHubError(error);
29692
+ }
29693
+ },
29694
+ describe: async (orgName, repoName) => {
29695
+ try {
29696
+ return await this.trpc.repo.describe.query({
29697
+ orgName,
29698
+ repoName
29699
+ });
29700
+ } catch (error) {
29701
+ throw toWarmHubError(error);
29702
+ }
29703
+ },
29626
29704
  setReadme: async (orgName, repoName, content) => {
29627
29705
  try {
29628
29706
  assertContentWithinLimit("Content/Readme.content", content);
@@ -42875,6 +42953,42 @@ function getHttpTimeoutSnapshot() {
42875
42953
  return snapshot;
42876
42954
  }
42877
42955
 
42956
+ // ../../packages/warmhub-cli/src/domains/doctor-repo-license.ts
42957
+ var LICENSE_SUBSTRATE = "warmhub-data/global.reference.licenses";
42958
+ async function checkRepoLicenseDeclaration(ctx, repo, repoInfo) {
42959
+ if (repoInfo.visibility !== "public")
42960
+ return null;
42961
+ const safeRepoRef = escapeTerminalTextForDisplay(repo.ref);
42962
+ try {
42963
+ const license = await ctx.client.repo.getLicense(repo.orgName, repo.repoName);
42964
+ if (license) {
42965
+ const safeSpdxId = escapeTerminalTextForDisplay(license.spdxId);
42966
+ return {
42967
+ key: "repo-license",
42968
+ name: "repo-license",
42969
+ status: "ok",
42970
+ message: `Public repo ${safeRepoRef} declares ${safeSpdxId}`
42971
+ };
42972
+ }
42973
+ return {
42974
+ key: "repo-license",
42975
+ name: "repo-license",
42976
+ status: "warn",
42977
+ message: `Public repo ${safeRepoRef} has no repository license declaration.`,
42978
+ detail: `Choose the correct license, then create the native LicenseSubject/repo thing and LicenseDeclaration/repo assertion. Set spdxIdRaw and, when applicable, licenseWref to a canonical License in ${LICENSE_SUBSTRATE}. No component installation is required.`
42979
+ };
42980
+ } catch (error) {
42981
+ const failure = classifyDoctorLookupError(error);
42982
+ const safeDescription = escapeTerminalTextForDisplay(failure.description);
42983
+ return {
42984
+ key: "repo-license",
42985
+ name: "repo-license",
42986
+ status: "warn",
42987
+ message: `Could not verify repository license declaration for public repo ${safeRepoRef}: ${safeDescription}`
42988
+ };
42989
+ }
42990
+ }
42991
+
42878
42992
  // ../../packages/warmhub-cli/src/domains/doctor-checks.ts
42879
42993
  async function collectChecks(ctx) {
42880
42994
  const harnessPaths = getHarnessPaths();
@@ -42920,14 +43034,18 @@ async function collectChecks(ctx) {
42920
43034
  status: apiUrl ? "ok" : "fail",
42921
43035
  message: apiUrl ? `API URL: ${apiUrl}` : "WARMHUB_API_URL not set and no default available"
42922
43036
  });
42923
- const repo = ctx.config.defaultRepo;
42924
- const repoSource = ctx.config.configSource?.repo;
43037
+ const repoFlag = getRepoRef(ctx);
43038
+ const hasRepoFlag = repoFlag !== undefined;
43039
+ const repo = repoFlag ?? ctx.config.defaultRepo;
43040
+ const repoParts = repo !== undefined ? splitRepoSlug(repo) : null;
43041
+ const repoForDisplay = repo !== undefined ? escapeTerminalTextForDisplay(repo) : undefined;
43042
+ const repoSource = hasRepoFlag ? "flag" : ctx.config.configSource?.repo;
42925
43043
  const repoProvenance = repoSource === "env" ? " (from WARMHUB_REPO)" : repoSource === "wh-file" ? " (from .wh file)" : repoSource === "flag" ? " (from --repo flag)" : "";
42926
43044
  checks.push({
42927
43045
  key: "default-repo",
42928
43046
  name: "default-repo",
42929
- status: repo ? "ok" : "warn",
42930
- message: repo ? `Default repo: ${repo}${repoProvenance}` : "No default repo set (use --repo flag, WARMHUB_REPO, or wh use org/repo)"
43047
+ status: repo !== undefined ? repoParts ? "ok" : "fail" : "warn",
43048
+ message: repo !== undefined ? repoParts ? `${hasRepoFlag ? "Target" : "Default"} repo: ${repoForDisplay}${repoProvenance}` : `Invalid repo format "${repoForDisplay}". Expected "org/repo".` : "No default repo set (use --repo flag, WARMHUB_REPO, or wh use org/repo)"
42931
43049
  });
42932
43050
  const profileFlag = ctx.invocation.flags.profile;
42933
43051
  const profile = (typeof profileFlag === "string" ? profileFlag : undefined) ?? ctx.config.profile ?? ctx.profile ?? "default";
@@ -43035,7 +43153,8 @@ async function collectChecks(ctx) {
43035
43153
  });
43036
43154
  }
43037
43155
  }
43038
- if (repo?.includes("/")) {
43156
+ if (repo !== undefined && repoParts) {
43157
+ const safeRepoRef = escapeTerminalTextForDisplay(repo);
43039
43158
  if (!backendOk) {
43040
43159
  checks.push({
43041
43160
  key: "repo",
@@ -43044,22 +43163,25 @@ async function collectChecks(ctx) {
43044
43163
  message: "Skipped (backend unreachable)"
43045
43164
  });
43046
43165
  } else {
43047
- const [orgName, repoName] = repo.split("/", 2);
43166
+ const { org: orgName, repo: repoName } = repoParts;
43048
43167
  try {
43049
- await ctx.client.repo.get(orgName, repoName);
43168
+ const repoInfo = await ctx.client.repo.get(orgName, repoName);
43050
43169
  checks.push({
43051
43170
  key: "repo",
43052
43171
  name: "repo",
43053
43172
  status: "ok",
43054
- message: `Repo ${repo} exists`
43173
+ message: `Repo ${safeRepoRef} exists`
43055
43174
  });
43175
+ const licenseCheck = await checkRepoLicenseDeclaration(ctx, { ref: repo, orgName, repoName }, repoInfo);
43176
+ if (licenseCheck)
43177
+ checks.push(licenseCheck);
43056
43178
  } catch (e) {
43057
43179
  const failure = classifyDoctorLookupError(e);
43058
43180
  checks.push({
43059
43181
  key: "repo",
43060
43182
  name: "repo",
43061
43183
  status: "fail",
43062
- message: failure.classification === "not-found" ? `Repo ${repo} not found: ${failure.description}` : `Repo ${repo} lookup failed: ${failure.description}`
43184
+ message: failure.classification === "not-found" ? `Repo ${safeRepoRef} not found: ${failure.description}` : `Repo ${safeRepoRef} lookup failed: ${failure.description}`
43063
43185
  });
43064
43186
  }
43065
43187
  }
@@ -44768,8 +44890,9 @@ var handleDescribe = async (ctx, { args, flags }) => {
44768
44890
  const { org, repo } = parseOrgRepo(repoRef, ctx.config);
44769
44891
  const c = ctx.colors;
44770
44892
  const showIndexedFields = flags["indexed-fields"] === true;
44771
- const [repoInfo, shapesPage, stats, indexedFields] = await Promise.all([
44893
+ const [repoInfo, license, shapesPage, stats, indexedFields] = await Promise.all([
44772
44894
  ctx.client.repo.get(org, repo),
44895
+ ctx.client.repo.getLicense(org, repo),
44773
44896
  ctx.client.shape.list(org, repo),
44774
44897
  ctx.client.repo.getStats(org, repo),
44775
44898
  showIndexedFields ? ctx.client.repo.index.describe(org, repo) : null
@@ -44792,6 +44915,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
44792
44915
  org,
44793
44916
  repo,
44794
44917
  description: repoInfo.description ?? null,
44918
+ license,
44795
44919
  counts: {
44796
44920
  byKind: stats.byKind,
44797
44921
  byShape
@@ -44815,6 +44939,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
44815
44939
  if (repoInfo.description) {
44816
44940
  ctx.out(` ${escapeTerminalTextForDisplay(repoInfo.description)}`);
44817
44941
  }
44942
+ ctx.out(` License: ${license ? escapeTerminalTextForDisplay(license.spdxExpression ?? license.spdxId) : "not declared"}`);
44818
44943
  ctx.out("");
44819
44944
  ctx.out(`${c.bold}Counts${c.reset} ${stats.byKind.shape} shapes, ${stats.byKind.thing} things, ${stats.byKind.assertion} assertions (${stats.total} total)`);
44820
44945
  const shapeCountEntries = Object.entries(byShape);
@@ -48972,7 +49097,7 @@ function resolveLogLevel(flagLevel, env) {
48972
49097
  // package.json
48973
49098
  var package_default3 = {
48974
49099
  name: "@warmhub/cli",
48975
- version: "0.80.0",
49100
+ version: "0.81.0",
48976
49101
  private: false,
48977
49102
  type: "module",
48978
49103
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -49589,5 +49714,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
49589
49714
  version: package_default3.version
49590
49715
  }) : interceptedExitCode;
49591
49716
 
49592
- //# debugId=3EAE1910B1B57D6664756E2164756E21
49593
- //# warmhub-cli-build-info {"cliVersion":"0.80.0","sdkVersion":"0.78.0"}
49717
+ //# debugId=2DA8F489DEFC62BA64756E2164756E21
49718
+ //# warmhub-cli-build-info {"cliVersion":"0.81.0","sdkVersion":"0.79.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",