Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d323cac
refactor: add missing types for attestation, remove gitAccount from A…
jescalada Dec 5, 2025
fd0db0b
chore: add missing Express.Request types in action files
jescalada Dec 5, 2025
aff314e
chore: add missing db types
jescalada Dec 5, 2025
8c50807
refactor: extend Express.Request to include bodyRaw and customPipe fi…
jescalada Dec 5, 2025
e928368
fix: proxy hanging on push due to improper req.pipe override
jescalada Dec 6, 2025
528d214
refactor: improve UI component and service typing
jescalada Dec 7, 2025
292c846
refactor: add BASE_COMMIT_CONTENT object to remove any types in testP…
jescalada Dec 11, 2025
6ff457e
chore: remove any types in ConfigLoader test (private field access)
jescalada Dec 11, 2025
1edc320
refactor: improve typings in various test files
jescalada Dec 11, 2025
4535c5a
refactor: add SAMPLE_COMMIT and remove any types in getDiff
jescalada Dec 11, 2025
1b4c2ab
chore: remove any types in gitLeaks tests
jescalada Dec 11, 2025
73c9c0b
chore: use SAMPLE_COMMIT for commit data and remove any types in chec…
jescalada Dec 11, 2025
30b86e3
chore: add various missing test stub types
jescalada Dec 11, 2025
d5e21db
chore: use SAMPLE_COMMIT for commit data in checkAuthorEmails tests
jescalada Dec 11, 2025
82bd72c
chore: remove any types in UI
jescalada Dec 12, 2025
3320f3f
refactor: repo and push UI error handling, remove any error types
jescalada Dec 12, 2025
ac9cf2b
refactor: test file any removal (proxy, testDb, repo, forcePush, preR…
jescalada Dec 12, 2025
f29ddbb
chore: add unknown typing to error catch and process message (plugin,…
jescalada Dec 12, 2025
06dc08a
refactor: add SAMPLE_REPO, replace in tests to remove any, add types …
jescalada Dec 12, 2025
ca4d703
Merge branch '1174-remove-any-and-as-ts-wrapup' of https://github.com…
jescalada Dec 12, 2025
a301eaa
refactor: cli test any/as removal, extract SAMPLE_REPO to constant
jescalada Dec 14, 2025
d6664f1
chore: add missing types for auth files and plugin.ts
jescalada Dec 14, 2025
3cd816f
refactor: remove any types from remaining catch(error)
jescalada Dec 14, 2025
3e56231
chore: remove general any/as in tests (req casting, etc.)
jescalada Dec 14, 2025
1863ff8
chore: add missing types for auth-related tests (oidc, activeDirector…
jescalada Dec 14, 2025
ce58dcc
refactor: db & checkCommitMessages tests to use Action instead of pus…
jescalada Dec 14, 2025
3824d09
refactor: remaining any/as removal in tests, explicit unknown casting…
jescalada Dec 14, 2025
a1455ca
chore: add unknown type to error catch clauses, improve error visibility
jescalada Dec 15, 2025
1f15141
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Dec 15, 2025
62a7d84
chore: fix failing test after error refactors
jescalada Dec 17, 2025
4d203e6
chore: fix failing tests (revision range error)
jescalada Dec 17, 2025
596257c
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Dec 17, 2025
edcfe3c
chore: fix Proxy type errors
jescalada Dec 17, 2025
b7b803c
fix: user.admin errors and failing e2e tests
jescalada Dec 17, 2025
b1fbeb6
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Feb 4, 2026
3dc2d3f
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Feb 9, 2026
d1fe161
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
kriswest Feb 12, 2026
5d2a3c3
Update packages/git-proxy-cli/index.ts
jescalada Feb 19, 2026
ad5b6f5
Update src/proxy/processors/push-action/parsePush.ts
jescalada Feb 19, 2026
3fbf55f
Update src/plugin.ts
jescalada Feb 19, 2026
20e2275
Update src/plugin.ts
jescalada Feb 19, 2026
edcc8c4
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Feb 19, 2026
c753c1d
fix: linter error
jescalada Feb 19, 2026
7f06f06
feat: add error handler functions and extract from catch clauses
jescalada Feb 19, 2026
10077f5
fix: authHeader null check
jescalada Feb 19, 2026
8a0c498
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Feb 20, 2026
28b570b
chore: improve error messages in push actions
jescalada Feb 20, 2026
143a9eb
chore: don't throw error on writePack, update tests
jescalada Feb 20, 2026
a2d3ffd
feat: add validateAttestation function to check attestation questions…
jescalada Feb 21, 2026
f2c0c60
feat: add CompletedAttestation, AttestationAnswer types and fix type …
jescalada Feb 21, 2026
8016d83
fix: failing e2e test due to boolean/string casting in validateAttest…
jescalada Feb 21, 2026
bae44da
refactor: src/services/routes/repo.ts into function, remove unnecessa…
jescalada Feb 21, 2026
8dd60cb
fix: RepoDetails classes and aria-label, PushRequests/PushesTable err…
jescalada Feb 21, 2026
c970f67
test: revert test removal due to type errors and use unknown casting …
jescalada Feb 23, 2026
a28ce83
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Feb 25, 2026
e828482
fix: rejection contents and type in autoActions.ts
jescalada Feb 25, 2026
fb025a0
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Mar 2, 2026
9fa39cf
Update src/config/validators.ts
jescalada Mar 5, 2026
3fcbc58
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Mar 5, 2026
da95d85
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Mar 5, 2026
5f77ec5
refactor: flatten repo test endpoints and fix failing tests
jescalada Mar 5, 2026
0d378ec
fix: remove any types, improve error handler functions
jescalada Mar 5, 2026
6a2cefe
Merge branch 'main' into 1174-remove-any-and-as-ts-wrapup
jescalada Mar 8, 2026
b2126db
chore: npm run lint:fix
jescalada Mar 8, 2026
93c5bb6
Update src/proxy/processors/push-action/preReceive.ts
jescalada Mar 10, 2026
c37cbab
Update src/proxy/chain.ts
jescalada Mar 10, 2026
7486aaa
fix: parsePush error handling
jescalada Mar 10, 2026
833543e
chore: fix duplicate apache headers
jescalada Mar 10, 2026
4b7d295
Merge branch '1174-remove-any-and-as-ts-wrapup' of https://github.com…
jescalada Mar 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 39 additions & 46 deletions packages/git-proxy-cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
* limitations under the License.
*/

import axios from 'axios';
import axios, { isAxiosError } from 'axios';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import fs from 'fs';
import util from 'util';

import { PushQuery } from '@finos/git-proxy/db';
import { Action } from '@finos/git-proxy/proxy/actions';
import { handleAndLogError } from '@finos/git-proxy/utils/errors';

const GIT_PROXY_COOKIE_FILE = 'git-proxy-cookie';
// GitProxy UI HOST and PORT (configurable via environment variable)
Expand Down Expand Up @@ -64,12 +65,12 @@ async function login(username: string, password: string) {
const user = `"${response.data.username}" <${response.data.email}>`;
const isAdmin = response.data.admin ? ' (admin)' : '';
console.log(`Login ${user}${isAdmin}: OK`);
} catch (error: any) {
if (error.response) {
} catch (error: unknown) {
if (isAxiosError(error) && error.response) {
console.error(`Error: Login '${username}': '${error.response.status}'`);
process.exitCode = 1;
} else {
console.error(`Error: Login '${username}': '${error.message}'`);
handleAndLogError(error, `Error: Login '${username}'`);
process.exitCode = 2;
}
}
Expand Down Expand Up @@ -182,8 +183,8 @@ async function getGitPushes(filters: Partial<PushQuery>) {
});

console.log(util.inspect(records, false, null, false));
} catch (error: any) {
console.error(`Error: List: '${error.message}'`);
} catch (error: unknown) {
handleAndLogError(error, 'Error: List');
process.exitCode = 2;
}
}
Expand Down Expand Up @@ -224,23 +225,21 @@ async function authoriseGitPush(id: string) {
);

console.log(`Authorise: ID: '${id}': OK`);
} catch (error: any) {
// default error
let errorMessage = `Error: Authorise: '${error.message}'`;
process.exitCode = 2;

if (error.response) {
} catch (error: unknown) {
if (isAxiosError(error) && error.response) {
switch (error.response.status) {
case 401:
errorMessage = 'Error: Authorise: Authentication required';
console.error('Error: Authorise: Authentication required');
process.exitCode = 3;
break;
case 404:
errorMessage = `Error: Authorise: ID: '${id}': Not Found`;
console.error(`Error: Authorise: ID: '${id}': Not Found`);
process.exitCode = 4;
}
} else {
handleAndLogError(error, `Error: Authorise: '${id}'`);
process.exitCode = 2;
}
console.error(errorMessage);
}
}

Expand Down Expand Up @@ -271,23 +270,21 @@ async function rejectGitPush(id: string) {
);

console.log(`Reject: ID: '${id}': OK`);
} catch (error: any) {
// default error
let errorMessage = `Error: Reject: '${error.message}'`;
process.exitCode = 2;

if (error.response) {
} catch (error: unknown) {
if (isAxiosError(error) && error.response) {
switch (error.response.status) {
case 401:
errorMessage = 'Error: Reject: Authentication required';
console.error('Error: Reject: Authentication required');
process.exitCode = 3;
break;
case 404:
errorMessage = `Error: Reject: ID: '${id}': Not Found`;
console.error(`Error: Reject: ID: '${id}': Not Found`);
process.exitCode = 4;
}
} else {
handleAndLogError(error, `Error: Reject: '${id}'`);
process.exitCode = 2;
}
console.error(errorMessage);
}
}

Expand Down Expand Up @@ -318,23 +315,21 @@ async function cancelGitPush(id: string) {
);

console.log(`Cancel: ID: '${id}': OK`);
} catch (error: any) {
// default error
let errorMessage = `Error: Cancel: '${error.message}'`;
process.exitCode = 2;

if (error.response) {
} catch (error: unknown) {
if (isAxiosError(error) && error.response) {
switch (error.response.status) {
case 401:
errorMessage = 'Error: Cancel: Authentication required';
console.error('Error: Cancel: Authentication required');
process.exitCode = 3;
break;
case 404:
errorMessage = `Error: Cancel: ID: '${id}': Not Found`;
console.error(`Error: Cancel: ID: '${id}': Not Found`);
process.exitCode = 4;
}
} else {
handleAndLogError(error, `Error: Cancel: '${id}'`);
process.exitCode = 2;
}
console.error(errorMessage);
}
}

Expand All @@ -355,8 +350,8 @@ async function logout() {
headers: { Cookie: cookies },
},
);
} catch (error: any) {
console.log(`Warning: Logout: '${error.message}'`);
} catch (error: unknown) {
handleAndLogError(error, 'Warning: Logout');
}
}

Expand All @@ -379,10 +374,9 @@ async function reloadConfig() {
await axios.post(`${baseUrl}/api/v1/admin/reload-config`, {}, { headers: { Cookie: cookies } });

console.log('Configuration reloaded successfully');
} catch (error: any) {
const errorMessage = `Error: Reload config: '${error.message}'`;
} catch (error: unknown) {
handleAndLogError(error, 'Error: Reload config');
process.exitCode = 2;
console.error(errorMessage);
}
}

Expand Down Expand Up @@ -425,23 +419,22 @@ async function createUser(
);

console.log(`User '${username}' created successfully`);
} catch (error: any) {
let errorMessage = `Error: Create User: '${error.message}'`;
process.exitCode = 2;

if (error.response) {
} catch (error: unknown) {
if (isAxiosError(error) && error.response) {
switch (error.response.status) {
case 401:
errorMessage = 'Error: Create User: Authentication required';
console.error('Error: Create User: Authentication required');
process.exitCode = 3;
break;
case 400:
errorMessage = `Error: Create User: ${error.response.data.message}`;
console.error(`Error: Create User: ${error.response.data.message}`);
process.exitCode = 4;
break;
}
} else {
handleAndLogError(error, `Error: Create User: '${username}'`);
process.exitCode = 2;
}
console.error(errorMessage);
}
}

Expand Down
Loading
Loading