oira666_pi-npm-token 0.1.0 → 0.1.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.
- package/README.md +5 -2
- package/package.json +3 -2
- package/src/index.ts +1 -4
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ chmod 600 ~/.pi/agent/npm-auth.json
|
|
|
45
45
|
|
|
46
46
|
Open that file in your editor and add the JSON above with your real token. Do not paste the token into chat or put it in a shell command. For project settings, also add `.pi/npm-auth.json` to the project's `.gitignore`. On Windows, restrict access using file permissions.
|
|
47
47
|
|
|
48
|
-
Run `/reload` or `/npm-token` after saving. The
|
|
48
|
+
Run `/reload` or `/npm-token` after saving. The extension is silent on success and does not add anything to the status line. Errors appear as plain TUI notifications. To verify the token, run `npm whoami`.
|
|
49
49
|
|
|
50
50
|
Now you or the assistant can run a normal local shell command:
|
|
51
51
|
|
|
@@ -81,11 +81,14 @@ This extension does not forward credentials to SSH hosts. Other extensions contr
|
|
|
81
81
|
```bash
|
|
82
82
|
npm install
|
|
83
83
|
npm test
|
|
84
|
-
npm
|
|
84
|
+
PI_EVERGREEN_PI_BIN=/absolute/path/to/global/pi npm run test:e2e
|
|
85
|
+
npm pack --dry-run --ignore-scripts
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
`npm test` first installs the latest stable Pi coding-agent development dependency from npm, runs strict TypeScript checking, and then runs the test suite. Registry access is required for the dependency refresh, which can update `package.json` and `package-lock.json`. Dependency lifecycle scripts are disabled during the refresh. If the update or typecheck fails, tests do not run. `npm run typecheck` checks the currently installed dependencies without refreshing them.
|
|
88
89
|
|
|
89
90
|
Tests use dummy credentials and local subprocesses. They cover configuration, project trust, private-file handling, npm environment inheritance, lifecycle behavior, and cleanup. They do not contact npm to authenticate or publish a package, and do not prove that a real token has publishing permission.
|
|
90
91
|
|
|
92
|
+
`npm run test:e2e` requires `PI_EVERGREEN_PI_BIN` pointing to the installed global Pi CLI; it never installs a runtime or skips coverage. It explicitly loads this extension into isolated RPC sessions and uses Pi's real OpenAI-compatible transport against a deterministic loopback SSE server, without model credentials or remote model calls. It verifies actual provider-bound requests and persisted sessions for sentinel-token leaks across tool turns, retries, compaction, credential reload, runtime reload, and session replacement. It also checks trusted/untrusted configuration, error recovery, environment restoration, and temporary-file cleanup. Negative controls exercise both the shell-auth probe and leak detector. Provider/model/reasoning labels honor `PI_EVERGREEN_E2E_PROVIDER`, `PI_EVERGREEN_E2E_MODEL`, and `PI_EVERGREEN_E2E_REASONING` (defaults: `openai`, `gpt-6-luna`, `medium`); these select the isolated test endpoint, not a live service.
|
|
93
|
+
|
|
91
94
|
Before every release, update the tested-against line at the top of this README to the actual Pi version that passed the checks. Keep the supported Pi peer range in `package.json` accurate, and inspect `npm pack --dry-run --ignore-scripts` to ensure no credentials or temporary files are packaged. The tracked root `AGENTS.md` contains the release instructions and code quality bar.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oira666_pi-npm-token",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Load npm publishing credentials from Pi settings for local shell commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"pretest": "npm install --save-dev --ignore-scripts @earendil-works/pi-coding-agent@latest && npm run typecheck",
|
|
39
|
-
"test": "node --experimental-strip-types --test test/*.test.ts"
|
|
39
|
+
"test": "node --experimental-strip-types --test test/*.test.ts",
|
|
40
|
+
"test:e2e": "node --test test/*.e2e.mjs"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"ini": "^7.0.0"
|
package/src/index.ts
CHANGED
|
@@ -15,9 +15,7 @@ export default function npmToken(pi: ExtensionAPI) {
|
|
|
15
15
|
await cleanup();
|
|
16
16
|
const settings = await loadSettings(ctx.cwd, getAgentDir(), ctx.isProjectTrusted());
|
|
17
17
|
if (settings) credentials = await activateCredentials(ctx.cwd, settings);
|
|
18
|
-
ctx.ui.setStatus("npm-token", credentials ? "npm token ready" : undefined);
|
|
19
18
|
} catch (error) {
|
|
20
|
-
ctx.ui.setStatus("npm-token", undefined);
|
|
21
19
|
ctx.ui.notify(error instanceof Error ? error.message : "Could not configure npm authentication.", "error");
|
|
22
20
|
}
|
|
23
21
|
}
|
|
@@ -28,11 +26,10 @@ export default function npmToken(pi: ExtensionAPI) {
|
|
|
28
26
|
catch { ctx.ui.notify("Could not remove the temporary npm config. Check the project's tmp directory.", "error"); }
|
|
29
27
|
});
|
|
30
28
|
pi.registerCommand("npm-token", {
|
|
31
|
-
description: "Reload npm-auth.json
|
|
29
|
+
description: "Reload npm-auth.json silently, reporting only errors",
|
|
32
30
|
handler: async (_args, ctx) => {
|
|
33
31
|
await ctx.waitForIdle();
|
|
34
32
|
await configure(ctx);
|
|
35
|
-
ctx.ui.notify(credentials ? "npm authentication is ready for local shell commands." : "npm authentication is not configured.", "info");
|
|
36
33
|
},
|
|
37
34
|
});
|
|
38
35
|
}
|