@newlandnpt/pep-cli 0.9.3 → 0.9.4

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/pep.cjs +30 -11
  2. package/package.json +1 -1
package/dist/pep.cjs CHANGED
@@ -23,6 +23,17 @@ var DEFAULT_SCOPES = [
23
23
  var DEFAULT_RESOURCES = ["urn:newland:pep:docs"];
24
24
  var LEGACY_PACKAGE = "semi-integration";
25
25
  var DEFAULT_DOCS_URL = "https://docs.newlandnpt.us";
26
+ var DOCS_BY_ISSUER = {
27
+ "https://pep.newlandnpt.us": "https://docs.newlandnpt.us",
28
+ "https://pep-webapp-view.onrender.com": "https://pep-developer-docs.onrender.com"
29
+ };
30
+ function docsUrlForIssuer(issuer) {
31
+ try {
32
+ return DOCS_BY_ISSUER[normalizeIssuer(issuer)];
33
+ } catch {
34
+ return void 0;
35
+ }
36
+ }
26
37
  var DEFAULT_SKILLS_GROUP = "distribution/skills";
27
38
  var EXAMPLE_SKILLS_REPO = `${DEFAULT_SKILLS_GROUP}/semi-integration-skill`;
28
39
  function issuerForEnvironment(environment) {
@@ -1376,6 +1387,7 @@ async function persistMavenEnv(credential, target = resolveTarget(), now = () =>
1376
1387
  var EXAMPLE_PATH = EXAMPLE_SKILLS_REPO;
1377
1388
  var EXAMPLE_REPO = `https://git.newlandpayment.com/${EXAMPLE_PATH}.git`;
1378
1389
  var PROJECT_FLAG = "-p, --project Install into ./.agents/skills of the current directory instead";
1390
+ var DOCS_URL_FLAG = `--docs-url <url> This run only; login picks the one paired with your PEP (default: ${DEFAULT_DOCS_URL})`;
1379
1391
  var REGION_FLAG = "--region <id> Documentation region for this run only (see pep docs regions)";
1380
1392
  var groups = {
1381
1393
  auth: {
@@ -1503,7 +1515,7 @@ pep skills update will not bring the skills back. Run pep skills add to do that.
1503
1515
  usage: "pep docs list [flags]",
1504
1516
  description: "Requires a saved PEP login. Prints each document's path and description.\nPass a path from this list to pep docs get to read its Markdown content.\n\nWithout --region you get the Global English documentation. The region applies to\nthis run only and is never remembered.",
1505
1517
  flags: [
1506
- `--docs-url <url> Documentation server; saved for later use (default: ${DEFAULT_DOCS_URL})`,
1518
+ DOCS_URL_FLAG,
1507
1519
  REGION_FLAG
1508
1520
  ],
1509
1521
  examples: [
@@ -1517,7 +1529,7 @@ pep skills update will not bring the skills back. Run pep skills add to do that.
1517
1529
  usage: "pep docs get <path> [flags]",
1518
1530
  description: "Requires a saved PEP login. Use a document path returned by pep docs list.\nWrites the document's Markdown to stdout, ready to pipe or save to a file.\n\nThe path already names its region, so a path from pep docs list --region na reads\nthe North American version. Pass --region to read that same document from another\nregion instead.",
1519
1531
  flags: [
1520
- `--docs-url <url> Documentation server; saved for later use (default: ${DEFAULT_DOCS_URL})`,
1532
+ DOCS_URL_FLAG,
1521
1533
  REGION_FLAG
1522
1534
  ],
1523
1535
  examples: [
@@ -1530,7 +1542,7 @@ pep skills update will not bring the skills back. Run pep skills add to do that.
1530
1542
  summary: "List the documentation regions this deployment serves.",
1531
1543
  usage: "pep docs regions [flags]",
1532
1544
  description: 'Prints one region per line: id, aliases, default language, name.\nThe list comes from the documentation server, so a region added there shows up\nwithout upgrading the CLI.\n\nThis is the one docs command that needs no login: "what do I pass to --region?"\nis a question you have before signing in.',
1533
- flags: [`--docs-url <url> Documentation server; saved for later use (default: ${DEFAULT_DOCS_URL})`],
1545
+ flags: [DOCS_URL_FLAG],
1534
1546
  examples: ["pep docs regions"]
1535
1547
  }
1536
1548
  }
@@ -1545,7 +1557,7 @@ pep skills update will not bring the skills back. Run pep skills add to do that.
1545
1557
  flags: [
1546
1558
  `--platform <name> Only this platform (${PLATFORMS.join(", ")})`,
1547
1559
  REGION_FLAG,
1548
- `--docs-url <url> Documentation server; saved for later use (default: ${DEFAULT_DOCS_URL})`
1560
+ DOCS_URL_FLAG
1549
1561
  ],
1550
1562
  examples: [
1551
1563
  "pep resources list",
@@ -1561,7 +1573,7 @@ pep skills update will not bring the skills back. Run pep skills add to do that.
1561
1573
  "--dir <path> Directory to save into; created if missing (default: the current directory)",
1562
1574
  "--force Replace an existing file of the same name",
1563
1575
  REGION_FLAG,
1564
- `--docs-url <url> Documentation server; saved for later use (default: ${DEFAULT_DOCS_URL})`
1576
+ DOCS_URL_FLAG
1565
1577
  ],
1566
1578
  examples: [
1567
1579
  "pep resources download SaleSystemDemo-4.8.0.2-win-x64.zip",
@@ -2552,7 +2564,7 @@ async function planSetup(dependencies) {
2552
2564
  }
2553
2565
 
2554
2566
  // src/cli.ts
2555
- var VERSION = false ? "0.0.0-dev" : "0.9.3";
2567
+ var VERSION = false ? "0.0.0-dev" : "0.9.4";
2556
2568
  var SKILLS_ADD_DEPRECATION = "\u26A0 `pep skills add` will be removed in a future release.";
2557
2569
  function createProgressReporter(stream = process.stderr) {
2558
2570
  if (!stream.isTTY) return void 0;
@@ -2654,14 +2666,14 @@ async function loginConfig(args, store = fileConfigStore()) {
2654
2666
  const explicit = repeatedOption(args, "--resource");
2655
2667
  const resources = explicit.length > 0 ? explicit : [...DEFAULT_RESOURCES];
2656
2668
  if (args.length > 0) throw new Error(`Unknown option: ${args[0]}`);
2657
- const saved = await store.read();
2669
+ const paired = docsUrlForIssuer(issuer);
2658
2670
  return {
2659
2671
  version: 1,
2660
2672
  issuer,
2661
2673
  clientId,
2662
2674
  redirectUri: DEFAULT_REDIRECT_URI,
2663
2675
  resources,
2664
- ...saved?.docsUrl !== void 0 ? { docsUrl: saved.docsUrl } : {}
2676
+ ...paired !== void 0 ? { docsUrl: paired } : {}
2665
2677
  };
2666
2678
  }
2667
2679
  function takeLoginOptions(args) {
@@ -2969,9 +2981,6 @@ ${usage(VERSION, [group])}`);
2969
2981
  }
2970
2982
  const saved = await configStore.read();
2971
2983
  const docsUrl = explicitDocsUrl ? normalizeDocsUrl(explicitDocsUrl) : saved?.docsUrl ?? DEFAULT_DOCS_URL;
2972
- if (explicitDocsUrl && saved && saved.docsUrl !== docsUrl) {
2973
- await configStore.write({ ...saved, docsUrl });
2974
- }
2975
2984
  if (action === "docs:regions") {
2976
2985
  const known = await fetchRegions({ docsUrl });
2977
2986
  for (const one of known.regions) {
@@ -3162,6 +3171,16 @@ ${usage(VERSION, ["skills"])}`);
3162
3171
  ${url}`)
3163
3172
  );
3164
3173
  console.log(`Logged in. Granted scopes: ${authorization.scopes.join(" ")}`);
3174
+ if (config.docsUrl !== void 0) {
3175
+ console.error(`Documentation site: ${config.docsUrl}`);
3176
+ } else {
3177
+ console.error(
3178
+ `\u26A0 No documentation site is paired with this PEP.
3179
+ docs and resources commands will use ${DEFAULT_DOCS_URL}, which checks
3180
+ tokens against a different PEP and will answer 401. Pass --docs-url to
3181
+ point them at the right one for this run.`
3182
+ );
3183
+ }
3165
3184
  return;
3166
3185
  }
3167
3186
  if (args.length > 0) throw new Error(`Unexpected argument: ${args[0]}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newlandnpt/pep-cli",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "PEP CLI —— 凭 PEP 身份读取 Newland 开发者文档与 agent skills",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",