Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
57 changes: 57 additions & 0 deletions installed-programs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@permitio/cli@0.0.0-placeholder /app/Bounty-Station-Access
+-- @ai-sdk/openai@1.3.24
+-- @apidevtools/swagger-parser@10.1.1
+-- @eslint/js@9.39.2
+-- @scaleway/random-name@5.1.3
+-- @sindresorhus/tsconfig@3.0.1
+-- @types/cli-table@0.3.4
+-- @types/he@1.2.3
+-- @types/react@18.3.27
+-- @typescript-eslint/eslint-plugin@8.53.1
+-- @typescript-eslint/parser@8.53.1
+-- @vitest/coverage-v8@2.1.9
+-- @vitest/ui@2.1.9
+-- ai@4.3.19
+-- chalk@5.6.2
+-- cli-table@0.3.11
+-- clipboardy@4.0.0
+-- cpx@1.5.0
+-- delay@6.0.0
+-- eslint-config-prettier@9.1.2
+-- eslint-config-xo-react@0.27.0
+-- eslint-define-config@2.1.0
+-- eslint-plugin-prettier@5.5.5
+-- eslint-plugin-react-hooks@5.2.0
+-- eslint-plugin-react@7.37.5
+-- eslint-plugin-sonarjs@2.0.4
+-- eslint@9.39.2
+-- fuse.js@7.1.0
+-- globals@15.15.0
+-- handlebars@4.7.8
+-- he@1.2.0
+-- ink-ascii@0.0.4
+-- ink-big-text@2.0.0
+-- ink-gradient@3.0.0
+-- ink-select-input@6.2.0
+-- ink-spinner@5.0.0
+-- ink-testing-library@4.0.0
+-- ink-text-input@6.0.0
+-- ink@5.2.1
+-- keytar@7.9.0
+-- micro-key-producer@0.7.6
+-- open@10.2.0
+-- openapi-fetch@0.13.8
+-- openapi-typescript@7.10.1
+-- parser@0.1.4
+-- pastel@3.0.0
+-- permitio@2.7.5 invalid: "2.6.1" from the root project
+-- prettier@3.8.1
+-- react@18.3.1
+-- rimraf@6.1.2
+-- ts-node@10.9.2
+-- tsx@4.21.0
+-- typescript-eslint@8.53.1
+-- typescript@5.9.3
+-- vitest@2.1.9
`-- zod@3.25.76

5 changes: 5 additions & 0 deletions restore_work.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd /app/Bounty-Station-Access
git fetch origin
git reset --hard origin/main
npm install
echo "DR Recovery Complete: Server is now synced with GitHub."
47 changes: 22 additions & 25 deletions source/components/policy/create/PolicyTables.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Box, Text } from 'ink';
import Table from 'cli-table';
import Table from 'cli-table3'; // Using cli-table3 for better border support
import chalk from 'chalk';
import { PolicyData } from './types.js';

Expand All @@ -17,31 +17,27 @@ export const PolicyTables: React.FC<PolicyTablesProps> = ({

const { resources, roles } = tableData;

// Calculate column widths based on content
const roleColumnWidths = roles.map(r => Math.max(15, r.name.length + 2));
// 1. DYNAMIC WIDTH CALCULATION: Prevent border breakage
// We check the length of all resource names and actions to find the perfect fit.
const allLabels = resources.flatMap(res => [res.name, ...res.actions.map(a => ` ${a}`)]);
const longestLabel = Math.max(...allLabels.map(l => l.length));
const firstColWidth = Math.min(50, Math.max(25, longestLabel + 4));

// Calculate role column widths
const roleColumnWidths = roles.map(r => Math.max(12, r.name.length + 2));

const table = new Table({
head: [
'', // Empty header for resources/actions column
...roles.map(r => chalk.hex('#FFA500')(r.name)), // Orange color for role names
chalk.cyan('Resource / Action'),
...roles.map(r => chalk.hex('#FFA500')(r.name)),
],
colWidths: [30, ...roleColumnWidths],
colWidths: [firstColWidth, ...roleColumnWidths],
wordWrap: true,
chars: {
top: '─',
'top-mid': '┬',
'top-left': '┌',
'top-right': '┐',
bottom: '─',
'bottom-mid': '┴',
'bottom-left': '└',
'bottom-right': '┘',
left: '│',
'left-mid': '├',
mid: '─',
'mid-mid': '┼',
right: '│',
'right-mid': '┤',
middle: '│',
top: '─', 'top-mid': '┬', 'top-left': '┌', 'top-right': '┐',
bottom: '─', 'bottom-mid': '┴', 'bottom-left': '└', 'bottom-right': '┘',
left: '│', 'left-mid': '├', mid: '─', 'mid-mid': '┼',
right: '│', 'right-mid': '┤', middle: '│',
},
});

Expand All @@ -58,18 +54,19 @@ export const PolicyTables: React.FC<PolicyTablesProps> = ({
const hasPermission = role.permissions.some(
p => p.resource === resource.name && p.actions.includes(action),
);
return hasPermission ? '✓' : '';
return hasPermission ? chalk.green('✓') : chalk.gray('·');
}),
];
table.push(row);
});
});

return (
<Box flexDirection="column">
<Box flexDirection="column" marginTop={1}>
<Text>{table.toString()}</Text>
{waitingForApproval && (
<Text color="yellow">Do you approve this policy? (yes/no)</Text>
<Box marginTop={1}>
<Text color="yellow">Do you approve this policy? (yes/no)</Text>
</Box>
)}
</Box>
);
Expand Down
Loading