rename package from @push.rocks/npmextra to @push.rocks/smartconfig

- Rename all source files from npmextra.* to simpler names (classes.appdata.ts, etc.)
- Rename Npmextra class to Smartconfig
- Config file changed from npmextra.json to smartconfig.json
- KV store path changed from ~/.npmextra/kv to ~/.smartconfig/kv
- Update all imports, tests, and metadata
This commit is contained in:
2026-03-24 14:56:23 +00:00
parent fdc2420238
commit 22a9aa9f3e
23 changed files with 202 additions and 363 deletions

View File

@@ -1,5 +1,5 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as npmextra from '../ts/index.js';
import * as smartconfig from '../ts/index.js';
// Test that sensitive values are properly redacted in logs
tap.test('should redact sensitive values in console output', async () => {
@@ -19,7 +19,7 @@ tap.test('should redact sensitive values in console output', async () => {
process.env['DEBUG_MODE'] = 'true';
// Create AppData with sensitive environment mappings
const appData = await npmextra.AppData.createAndInit({
const appData = await smartconfig.AppData.createAndInit({
ephemeral: true,
envMapping: {
apiKey: 'API_KEY',
@@ -39,22 +39,22 @@ tap.test('should redact sensitive values in console output', async () => {
// Check that sensitive values were redacted in logs
const combinedOutput = logOutput.join('\n');
// API_KEY should be redacted
expect(combinedOutput).toContain('sup...[26 chars]');
expect(combinedOutput).not.toContain('super-secret-api-key-12345');
// DATABASE_PASSWORD should be redacted
expect(combinedOutput).toContain('myP...[13 chars]');
expect(combinedOutput).not.toContain('myP@ssw0rd123');
// AUTH_TOKEN should be redacted (JWT tokens starting with eyJ)
expect(combinedOutput).toContain('eyJ...[');
expect(combinedOutput).not.toContain('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9');
// PUBLIC_URL should not be redacted (not sensitive)
expect(combinedOutput).toContain('https://example.com');
// DEBUG_MODE should not be redacted (not sensitive)
expect(combinedOutput).toContain('true');
@@ -63,16 +63,16 @@ tap.test('should redact sensitive values in console output', async () => {
const apiKey = await kvStore.readKey('apiKey');
const dbPassword = await kvStore.readKey('dbPassword');
const publicUrl = await kvStore.readKey('publicUrl');
// Actual values should be stored correctly
expect(apiKey).toEqual('super-secret-api-key-12345');
expect(dbPassword).toEqual('myP@ssw0rd123');
expect(publicUrl).toEqual('https://example.com');
} finally {
// Restore console.log in case of test failure
console.log = originalLog;
// Clean up environment variables
delete process.env['API_KEY'];
delete process.env['DATABASE_PASSWORD'];
@@ -82,4 +82,4 @@ tap.test('should redact sensitive values in console output', async () => {
}
});
export default tap.start();
export default tap.start();