@olorehq/olore 0.3.1 → 0.3.2

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/cli.js +69 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -25,7 +25,8 @@ import fs from "fs-extra";
25
25
  import * as tar from "tar";
26
26
 
27
27
  // src/core/constants.ts
28
- var REGISTRY_URL = "https://olore.dev/registry";
28
+ var REGISTRY_URL = "https://github.com/olorehq/olore/releases/download/registry/registry.json";
29
+ var REGISTRY_FALLBACK_URL = "https://olore.dev/registry";
29
30
  var DOWNLOAD_TIMEOUT = 6e4;
30
31
  var USER_AGENT = "olore-cli/0.1.0";
31
32
 
@@ -925,8 +926,23 @@ async function fetchWithTimeout(url, timeout = DOWNLOAD_TIMEOUT) {
925
926
  clearTimeout(timeoutId);
926
927
  }
927
928
  }
928
- async function fetchPackageIndex() {
929
- const url = `${REGISTRY_URL}/index.json`;
929
+ var cachedRegistry = null;
930
+ async function fetchCombinedRegistry() {
931
+ if (cachedRegistry) {
932
+ return cachedRegistry;
933
+ }
934
+ try {
935
+ const response2 = await fetchWithTimeout(REGISTRY_URL);
936
+ if (response2.ok) {
937
+ const data = await response2.json();
938
+ if (data.version === 2) {
939
+ cachedRegistry = data;
940
+ return cachedRegistry;
941
+ }
942
+ }
943
+ } catch {
944
+ }
945
+ const url = `${REGISTRY_FALLBACK_URL}/index.json`;
930
946
  const response = await fetchWithTimeout(url);
931
947
  if (response.status === 404) {
932
948
  throw new RegistryError("Registry not found", "NOT_FOUND");
@@ -934,15 +950,58 @@ async function fetchPackageIndex() {
934
950
  if (!response.ok) {
935
951
  throw new RegistryError(`Failed to fetch registry: ${response.status}`, "NETWORK_ERROR");
936
952
  }
953
+ let index;
937
954
  try {
938
- const data = await response.json();
939
- return data;
955
+ index = await response.json();
940
956
  } catch {
941
957
  throw new RegistryError("Invalid registry response", "INVALID_RESPONSE");
942
958
  }
959
+ const packages = {};
960
+ for (const [name, entry] of Object.entries(index.packages)) {
961
+ packages[name] = {
962
+ description: entry.description,
963
+ latest: entry.latest,
964
+ versions: {}
965
+ // populated on demand in fetchPackageVersions
966
+ };
967
+ }
968
+ cachedRegistry = {
969
+ version: 2,
970
+ updated: index.updated,
971
+ packages
972
+ };
973
+ return cachedRegistry;
974
+ }
975
+ async function fetchPackageIndex() {
976
+ const combined = await fetchCombinedRegistry();
977
+ const packages = {};
978
+ for (const [name, entry] of Object.entries(combined.packages)) {
979
+ packages[name] = {
980
+ description: entry.description,
981
+ latest: entry.latest,
982
+ versions: Object.keys(entry.versions).length > 0 ? Object.keys(entry.versions) : [entry.latest]
983
+ };
984
+ }
985
+ return {
986
+ version: combined.version,
987
+ updated: combined.updated,
988
+ packages
989
+ };
943
990
  }
944
991
  async function fetchPackageVersions(name) {
945
- const url = `${REGISTRY_URL}/packages/${name}.json`;
992
+ const combined = await fetchCombinedRegistry();
993
+ const entry = combined.packages[name];
994
+ if (!entry) {
995
+ throw new RegistryError(`Package "${name}" not found in registry`, "NOT_FOUND");
996
+ }
997
+ if (Object.keys(entry.versions).length > 0) {
998
+ return {
999
+ name,
1000
+ description: entry.description,
1001
+ versions: entry.versions
1002
+ };
1003
+ }
1004
+ const url = `${REGISTRY_FALLBACK_URL}/packages/${name}.json`;
946
1005
  const response = await fetchWithTimeout(url);
947
1006
  if (response.status === 404) {
948
1007
  throw new RegistryError(`Package "${name}" not found in registry`, "NOT_FOUND");
@@ -952,7 +1011,9 @@ async function fetchPackageVersions(name) {
952
1011
  }
953
1012
  try {
954
1013
  const data = await response.json();
955
- return data;
1014
+ const versions = data;
1015
+ entry.versions = versions.versions;
1016
+ return versions;
956
1017
  } catch {
957
1018
  throw new RegistryError("Invalid package response", "INVALID_RESPONSE");
958
1019
  }
@@ -980,7 +1041,7 @@ import pc4 from "picocolors";
980
1041
  // package.json
981
1042
  var package_default = {
982
1043
  name: "@olorehq/olore",
983
- version: "0.3.1",
1044
+ version: "0.3.2",
984
1045
  description: "Universal documentation for any AI coding agent",
985
1046
  keywords: [
986
1047
  "ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olorehq/olore",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Universal documentation for any AI coding agent",
5
5
  "keywords": [
6
6
  "ai",