@newlandnpt/pep-cli 0.7.0 → 0.8.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.
- package/README.md +35 -9
- package/dist/pep.cjs +51 -33
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -72,16 +72,17 @@ The issuer is fixed at build time:
|
|
|
72
72
|
`--issuer` remains available only as a temporary override — it is **not** remembered, so every
|
|
73
73
|
`auth login` needs it again. That is why the built-in default decides where most users land.
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
|
|
78
|
-
departments to use now.
|
|
75
|
+
The npm release is built from `production` — it ships `https://pep.newlandnpt.us` and that
|
|
76
|
+
deployment's `client_id`. Both are baked in at build time, so a release already out in the wild
|
|
77
|
+
cannot be repointed; a change to either needs a new version.
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
⚠ **This package is only ready-to-use against production.** `/authorize` looks the `client_id` up
|
|
80
|
+
in each deployment's own database, so the baked one does not exist on dev or view. To reach a
|
|
81
|
+
non-production deployment you must pass **both** flags, **every login** — neither is remembered:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
pep auth login --issuer https://pep-webapp-dev.onrender.com --client-id <that deployment's id>
|
|
85
|
+
```
|
|
85
86
|
|
|
86
87
|
## Skills
|
|
87
88
|
|
|
@@ -193,6 +194,31 @@ offers".
|
|
|
193
194
|
Skills that are **new upstream** are still installed by `update` — the test is "was mine and is now
|
|
194
195
|
gone", not "is absent".
|
|
195
196
|
|
|
197
|
+
## Maven credentials
|
|
198
|
+
|
|
199
|
+
```powershell
|
|
200
|
+
pep nexus setup
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Asks PEP for your Maven repository credential and saves it as the two environment variables the
|
|
204
|
+
Newland Android SDK reads (`NEWLAND_MAVEN_USERNAME` / `NEWLAND_MAVEN_PASSWORD`). Windows uses
|
|
205
|
+
`setx`; macOS keeps a marked block in your shell profile, backed up first.
|
|
206
|
+
|
|
207
|
+
**The password is never printed.** The credential is derived from who you are, so running this
|
|
208
|
+
again — on this machine or any other — hands you the same one; nothing is lost by not showing it.
|
|
209
|
+
Use `--print-env` when you want the two lines on stdout instead:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
eval "$(pep nexus setup --print-env)" # the shell you are in gets them now
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The credential is per person, not per company — colleagues get their own, and so does the same
|
|
216
|
+
account on a second machine.
|
|
217
|
+
|
|
218
|
+
⚠ Persistence only reaches **new** processes. A running IDE keeps the environment it started with,
|
|
219
|
+
and the Gradle daemon outlives the IDE, so after the first setup: quit Android Studio completely,
|
|
220
|
+
run `gradlew --stop`, then reopen.
|
|
221
|
+
|
|
196
222
|
`pep auth token` writes only the access token to stdout, so agents can use it without parsing status
|
|
197
223
|
text. Refresh occurs automatically shortly before expiry and the rotated refresh token replaces the old
|
|
198
224
|
credential atomically.
|
package/dist/pep.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var import_node_path2 = require("node:path");
|
|
|
9
9
|
var import_promises = require("node:fs/promises");
|
|
10
10
|
var import_node_os = require("node:os");
|
|
11
11
|
var import_node_path = require("node:path");
|
|
12
|
-
var DEFAULT_CLIENT_ID = "
|
|
12
|
+
var DEFAULT_CLIENT_ID = "a96eccf418a4591f738e395fa6d0a0ef";
|
|
13
13
|
var DEFAULT_REDIRECT_URI = "http://localhost:53682/callback";
|
|
14
14
|
var DEFAULT_SCOPES = [
|
|
15
15
|
"openid",
|
|
@@ -21,13 +21,13 @@ var DEFAULT_SCOPES = [
|
|
|
21
21
|
];
|
|
22
22
|
var DEFAULT_RESOURCES = ["urn:newland:pep:docs"];
|
|
23
23
|
var LEGACY_PACKAGE = "semi-integration";
|
|
24
|
-
var DEFAULT_DOCS_URL = "https://
|
|
24
|
+
var DEFAULT_DOCS_URL = "https://docs.newlandnpt.us";
|
|
25
25
|
function issuerForEnvironment(environment) {
|
|
26
26
|
if (environment === "production") return "https://pep.newlandnpt.us";
|
|
27
27
|
if (environment === "view") return "https://pep-webapp-view.onrender.com";
|
|
28
28
|
return "https://pep-webapp-dev.onrender.com";
|
|
29
29
|
}
|
|
30
|
-
var BUILD_ENVIRONMENT = false ? "development" : "
|
|
30
|
+
var BUILD_ENVIRONMENT = false ? "development" : "production";
|
|
31
31
|
var DEFAULT_ISSUER = issuerForEnvironment(BUILD_ENVIRONMENT);
|
|
32
32
|
function configuredIssuer(explicitIssuer) {
|
|
33
33
|
return explicitIssuer ?? DEFAULT_ISSUER;
|
|
@@ -974,7 +974,7 @@ function describeFailure2(status, code) {
|
|
|
974
974
|
return "This access token carries no `nexus-credentials:write` scope. Ask an operator to add it to this client's allowed_scopes in PEP, then run `pep auth login` again \u2014 existing tokens do not gain new scopes.";
|
|
975
975
|
}
|
|
976
976
|
if (status === 409) {
|
|
977
|
-
return "This
|
|
977
|
+
return "This PEP deployment still issues one Maven credential per company, so it cannot give you yours again. Newer PEP issues one per person and can always re-derive it \u2014 ask an operator to upgrade this deployment; until then, copy the credential from the machine that has it.";
|
|
978
978
|
}
|
|
979
979
|
if (status === 503) {
|
|
980
980
|
return "PEP could not reach Nexus (not configured, or upstream is down). This is a platform-side problem \u2014 retrying will not help. Report it to a PEP operator.";
|
|
@@ -1426,7 +1426,7 @@ async function updateSkills(dependencies) {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
|
|
1428
1428
|
// src/cli.ts
|
|
1429
|
-
var VERSION = false ? "0.0.0-dev" : "0.
|
|
1429
|
+
var VERSION = false ? "0.0.0-dev" : "0.8.0";
|
|
1430
1430
|
function usage() {
|
|
1431
1431
|
return `PEP CLI ${VERSION}
|
|
1432
1432
|
|
|
@@ -1441,7 +1441,7 @@ Usage:
|
|
|
1441
1441
|
pep skills remove <repo>
|
|
1442
1442
|
pep docs list [--docs-url <url>]
|
|
1443
1443
|
pep docs get <path> [--docs-url <url>]
|
|
1444
|
-
pep nexus setup
|
|
1444
|
+
pep nexus setup [--print-env]
|
|
1445
1445
|
|
|
1446
1446
|
The issuer is built into this executable. --issuer overrides it for that one command and is
|
|
1447
1447
|
NOT remembered \u2014 pass it every time you log in against a non-default deployment.
|
|
@@ -1502,15 +1502,20 @@ hand is left alone.
|
|
|
1502
1502
|
straight to \`pep docs get\` to print that document as markdown on stdout. The documentation
|
|
1503
1503
|
site is built in (${DEFAULT_DOCS_URL}); --docs-url overrides it and is then remembered.
|
|
1504
1504
|
|
|
1505
|
-
\`pep nexus setup\` asks PEP for
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1505
|
+
\`pep nexus setup\` asks PEP for your Maven repository credential and saves it as the two
|
|
1506
|
+
environment variables the Newland Android SDK reads \u2014 \`${USERNAME_VAR}\` and \`${PASSWORD_VAR}\`
|
|
1507
|
+
\u2014 so you do not copy anything by hand. On Windows it writes them to your user environment
|
|
1508
|
+
(\`setx\`); on macOS it keeps a marked block in your shell profile, backing the file up first and
|
|
1509
|
+
touching nothing else. Either way persistence only affects NEW shells.
|
|
1510
|
+
|
|
1511
|
+
**The password is never printed.** The credential is derived from who you are, so running this
|
|
1512
|
+
again \u2014 on this machine or any other \u2014 hands you the same one. Nothing is lost by not showing it.
|
|
1513
|
+
\`--print-env\` writes the two lines to stdout instead, for
|
|
1514
|
+
\`eval "$(pep nexus setup --print-env)"\` when you want the shell you are in to have them now.
|
|
1515
|
+
|
|
1516
|
+
The credential is per person, not per company: your colleagues get their own, and so does the same
|
|
1517
|
+
account on a second machine. Only Android needs this \u2014 the Windows and iOS SDKs are cloned from
|
|
1518
|
+
Git, not pulled from Maven.`;
|
|
1514
1519
|
}
|
|
1515
1520
|
function reportUpdate(result) {
|
|
1516
1521
|
const conflicts = () => {
|
|
@@ -1622,6 +1627,33 @@ function targetForSource(chosen, recorded) {
|
|
|
1622
1627
|
...recorded.linkedInto !== void 0 ? { linkInto: recorded.linkedInto } : {}
|
|
1623
1628
|
};
|
|
1624
1629
|
}
|
|
1630
|
+
function nexusReport(result, printEnv) {
|
|
1631
|
+
const stdout = printEnv ? [result.lines] : [];
|
|
1632
|
+
const stderr = [];
|
|
1633
|
+
const persisted = result.persisted;
|
|
1634
|
+
if (persisted.status === "windows") {
|
|
1635
|
+
stderr.push(`Saved ${USERNAME_VAR} and ${PASSWORD_VAR} to your Windows user environment.`);
|
|
1636
|
+
stderr.push("Existing terminals do not see them \u2014 open a new one.");
|
|
1637
|
+
stderr.push("Android Studio / IntelliJ must be fully quit and reopened \u2014 its built-in");
|
|
1638
|
+
stderr.push("terminal inherits the old environment too.");
|
|
1639
|
+
stderr.push("Then stop the Gradle daemon, which outlives the IDE: `gradlew --stop`.");
|
|
1640
|
+
} else if (persisted.status === "manual") {
|
|
1641
|
+
stderr.push(
|
|
1642
|
+
`Nothing was written${persisted.path ? ` to ${persisted.path}` : ""}: ${persisted.reason}`
|
|
1643
|
+
);
|
|
1644
|
+
stderr.push("Run this again to get the same credential \u2014 it is derived, not stored.");
|
|
1645
|
+
} else {
|
|
1646
|
+
stderr.push(
|
|
1647
|
+
persisted.status === "profile-replaced" ? `Replaced the pep-cli block in ${persisted.path}` : `Appended a pep-cli block to ${persisted.path}`
|
|
1648
|
+
);
|
|
1649
|
+
if (persisted.backupPath) stderr.push(`Backup: ${persisted.backupPath}`);
|
|
1650
|
+
stderr.push("New shells will have it; this one will not until you re-source the profile.");
|
|
1651
|
+
stderr.push("Android Studio / IntelliJ must be fully quit and reopened, then");
|
|
1652
|
+
stderr.push("stop the Gradle daemon, which outlives it: `./gradlew --stop`.");
|
|
1653
|
+
}
|
|
1654
|
+
stderr.push(`Nexus user: ${result.username}`);
|
|
1655
|
+
return { stdout, stderr };
|
|
1656
|
+
}
|
|
1625
1657
|
async function main() {
|
|
1626
1658
|
const args = process.argv.slice(2);
|
|
1627
1659
|
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
@@ -1679,30 +1711,16 @@ ${usage()}`);
|
|
|
1679
1711
|
if (command !== "setup") throw new Error(`Unknown nexus command.
|
|
1680
1712
|
|
|
1681
1713
|
${usage()}`);
|
|
1714
|
+
const printEnv = flag(args, "--print-env");
|
|
1682
1715
|
if (args.length > 0) throw new Error(`Unknown option: ${args[0]}`);
|
|
1683
1716
|
const authorization = await auth.currentAuthorization();
|
|
1684
1717
|
const result = await setupNexusCredential({
|
|
1685
1718
|
issuer: authorization.issuer,
|
|
1686
1719
|
accessToken: authorization.accessToken
|
|
1687
1720
|
});
|
|
1688
|
-
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
console.error(`Saved ${USERNAME_VAR} and ${PASSWORD_VAR} to your Windows user environment.`);
|
|
1692
|
-
console.error("Existing terminals do not see them \u2014 open a new one (or use the lines above).");
|
|
1693
|
-
} else if (persisted.status === "manual") {
|
|
1694
|
-
console.error(
|
|
1695
|
-
`Nothing was written${persisted.path ? ` to ${persisted.path}` : ""}: ${persisted.reason}`
|
|
1696
|
-
);
|
|
1697
|
-
console.error("The two lines above are the only copy \u2014 PEP does not store the password.");
|
|
1698
|
-
} else {
|
|
1699
|
-
console.error(
|
|
1700
|
-
persisted.status === "profile-replaced" ? `Replaced the pep-cli block in ${persisted.path}` : `Appended a pep-cli block to ${persisted.path}`
|
|
1701
|
-
);
|
|
1702
|
-
if (persisted.backupPath) console.error(`Backup: ${persisted.backupPath}`);
|
|
1703
|
-
console.error("New shells will have it; this one will not until you re-source the profile.");
|
|
1704
|
-
}
|
|
1705
|
-
console.error(`Nexus user: ${result.username}`);
|
|
1721
|
+
const report = nexusReport(result, printEnv);
|
|
1722
|
+
for (const line of report.stdout) console.log(line);
|
|
1723
|
+
for (const line of report.stderr) console.error(line);
|
|
1706
1724
|
return;
|
|
1707
1725
|
}
|
|
1708
1726
|
if (group === "skills") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlandnpt/pep-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "PEP CLI —— 凭 PEP 身份读取 Newland 开发者文档与 agent skills",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build:installer": "node scripts/build-installer.mjs production",
|
|
29
29
|
"build:installer:dev": "node scripts/build-installer.mjs development",
|
|
30
30
|
"build:installer:prod": "node scripts/build-installer.mjs production",
|
|
31
|
-
"prepack": "node scripts/build-js.mjs
|
|
31
|
+
"prepack": "node scripts/build-js.mjs production",
|
|
32
32
|
"build:exe:view": "node scripts/build-exe.mjs view",
|
|
33
33
|
"build:installer:view": "node scripts/build-installer.mjs view"
|
|
34
34
|
},
|