matex-cli 1.2.65 → 1.2.67
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/dist/commands/augov.d.ts +3 -0
- package/dist/commands/augov.d.ts.map +1 -0
- package/dist/commands/augov.js +112 -0
- package/dist/commands/augov.js.map +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +19 -326
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +17 -492
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/study.d.ts.map +1 -1
- package/dist/commands/study.js +17 -393
- package/dist/commands/study.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/prompts/banter-augov.d.ts +2 -0
- package/dist/prompts/banter-augov.d.ts.map +1 -0
- package/dist/prompts/banter-augov.js +21 -0
- package/dist/prompts/banter-augov.js.map +1 -0
- package/dist/prompts/banter.d.ts +6 -0
- package/dist/prompts/banter.d.ts.map +1 -0
- package/dist/prompts/banter.js +101 -0
- package/dist/prompts/banter.js.map +1 -0
- package/dist/prompts/system-prompts.d.ts +4 -0
- package/dist/prompts/system-prompts.d.ts.map +1 -0
- package/dist/prompts/system-prompts.js +215 -0
- package/dist/prompts/system-prompts.js.map +1 -0
- package/dist/session/agent-session.d.ts +39 -0
- package/dist/session/agent-session.d.ts.map +1 -0
- package/dist/session/agent-session.js +399 -0
- package/dist/session/agent-session.js.map +1 -0
- package/dist/utils/agent-orchestrator.d.ts +1 -1
- package/dist/utils/agent-orchestrator.d.ts.map +1 -1
- package/dist/utils/agent-orchestrator.js +15 -1
- package/dist/utils/agent-orchestrator.js.map +1 -1
- package/dist/utils/augov-logger.d.ts +11 -0
- package/dist/utils/augov-logger.d.ts.map +1 -0
- package/dist/utils/augov-logger.js +35 -0
- package/dist/utils/augov-logger.js.map +1 -0
- package/dist/utils/augov-scrubber.d.ts +15 -0
- package/dist/utils/augov-scrubber.d.ts.map +1 -0
- package/dist/utils/augov-scrubber.js +37 -0
- package/dist/utils/augov-scrubber.js.map +1 -0
- package/dist/utils/command-executor.d.ts.map +1 -1
- package/dist/utils/command-executor.js +1 -5
- package/dist/utils/command-executor.js.map +1 -1
- package/dist/utils/tui.d.ts +2 -2
- package/dist/utils/tui.d.ts.map +1 -1
- package/dist/utils/tui.js +14 -2
- package/dist/utils/tui.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/augov.ts +117 -0
- package/src/commands/chat.ts +19 -291
- package/src/commands/dev.ts +18 -470
- package/src/commands/study.ts +18 -366
- package/src/index.ts +2 -0
- package/src/prompts/banter-augov.ts +17 -0
- package/src/prompts/banter.ts +101 -0
- package/src/prompts/system-prompts.ts +213 -0
- package/src/session/agent-session.ts +401 -0
- package/src/utils/agent-orchestrator.ts +18 -4
- package/src/utils/augov-logger.ts +34 -0
- package/src/utils/augov-scrubber.ts +34 -0
- package/src/utils/command-executor.ts +1 -5
- package/src/utils/tui.ts +17 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* IRAP-Compliant Audit Logger
|
|
6
|
+
* The Australian Government requires strict logging of AI tool usage.
|
|
7
|
+
* This logger records prompts and actions locally so security teams can audit them.
|
|
8
|
+
*/
|
|
9
|
+
export class GovAuditLogger {
|
|
10
|
+
private logFile: string;
|
|
11
|
+
|
|
12
|
+
constructor(baseDir: string = process.cwd()) {
|
|
13
|
+
const logDir = path.join(baseDir, '.matex_audit');
|
|
14
|
+
if (!fs.existsSync(logDir)) {
|
|
15
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Create an auditable log per day
|
|
19
|
+
const today = new Date().toISOString().split('T')[0];
|
|
20
|
+
this.logFile = path.join(logDir, `augov_audit_${today}.log`);
|
|
21
|
+
|
|
22
|
+
if (!fs.existsSync(this.logFile)) {
|
|
23
|
+
fs.writeFileSync(this.logFile, 'TIMESTAMP | ROLE | ACTION | CONTENT\n');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public logInteraction(role: 'USER' | 'AI_SWARM' | 'SYSTEM', action: string, content: string) {
|
|
28
|
+
const timestamp = new Date().toISOString();
|
|
29
|
+
const cleanContent = content.replace(/\n/g, ' ').substring(0, 500); // truncate for CSV safety, full logs can be large
|
|
30
|
+
const logEntry = `${timestamp} | ${role} | ${action} | ${cleanContent}\n`;
|
|
31
|
+
|
|
32
|
+
fs.appendFileSync(this.logFile, logEntry);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Citizen Privacy Shield
|
|
3
|
+
* A local redaction engine that scrubs Australian PII (Personally Identifiable Information)
|
|
4
|
+
* BEFORE it ever leaves the user's computer to hit an AI API.
|
|
5
|
+
*/
|
|
6
|
+
export class GovPrivacyScrubber {
|
|
7
|
+
|
|
8
|
+
// Regex patterns for Australian specific sensitive data
|
|
9
|
+
private static patterns = [
|
|
10
|
+
// Australian Tax File Number (TFN) - 9 digits
|
|
11
|
+
{ regex: /\b\d{3}[- ]?\d{3}[- ]?\d{3}\b/g, replacement: '[REDACTED_TFN]' },
|
|
12
|
+
// Medicare Number - 10 digits
|
|
13
|
+
{ regex: /\b[2-6]\d{9}\b/g, replacement: '[REDACTED_MEDICARE]' },
|
|
14
|
+
// Australian Phone Numbers (Mobile & Landline)
|
|
15
|
+
{ regex: /(?:\+?61|0)[2-478](?:[ -]?[0-9]){8}\b/g, replacement: '[REDACTED_PHONE]' },
|
|
16
|
+
// Email Addresses
|
|
17
|
+
{ regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g, replacement: '[REDACTED_EMAIL]' },
|
|
18
|
+
// Credit Card Numbers
|
|
19
|
+
{ regex: /\b(?:\d[ -]*?){13,16}\b/g, replacement: '[REDACTED_CREDIT_CARD]' }
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Scrubs sensitive data from a string.
|
|
24
|
+
* @param input Raw string from user or file
|
|
25
|
+
* @returns Scrubbed string safe for AI processing
|
|
26
|
+
*/
|
|
27
|
+
public static scrub(input: string): string {
|
|
28
|
+
let scrubbed = input;
|
|
29
|
+
for (const rule of this.patterns) {
|
|
30
|
+
scrubbed = scrubbed.replace(rule.regex, rule.replacement);
|
|
31
|
+
}
|
|
32
|
+
return scrubbed;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -92,7 +92,7 @@ export function isSafeAutoCommand(command: string): boolean {
|
|
|
92
92
|
// File Discovery & Read
|
|
93
93
|
'cat ', 'ls ', 'grep ', 'find ', 'pwd', 'echo ', 'read ', 'type ', 'dir',
|
|
94
94
|
// File Operations
|
|
95
|
-
'mkdir ', 'touch ', 'cp ', '
|
|
95
|
+
'mkdir ', 'touch ', 'cp ', 'copy ',
|
|
96
96
|
// Dev Tools
|
|
97
97
|
'npm ', 'npx ', 'git ', 'node ', 'python ', 'python3 ', 'pip ', 'pip3 ',
|
|
98
98
|
// Cloud & Mobile
|
|
@@ -101,10 +101,6 @@ export function isSafeAutoCommand(command: string): boolean {
|
|
|
101
101
|
'cd ', 'tsc ', 'vite ', 'next ', 'cargo ', 'go ', 'swift '
|
|
102
102
|
];
|
|
103
103
|
const trimmed = command.trim();
|
|
104
|
-
// Special check: 'rm' is only safe if it's NOT recursive or if it targets a specific file
|
|
105
|
-
if (trimmed.startsWith('rm ') && (trimmed.includes(' -rf') || trimmed.includes(' /*'))) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
104
|
return safePrefixes.some(prefix => trimmed.startsWith(prefix));
|
|
109
105
|
}
|
|
110
106
|
|
package/src/utils/tui.ts
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import * as readline from 'readline';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
-
export type TUIMode = 'dev' | 'study' | 'chat' | 'student';
|
|
5
|
+
export type TUIMode = 'dev' | 'study' | 'chat' | 'student' | 'augov';
|
|
6
6
|
|
|
7
7
|
export interface ModeTheme {
|
|
8
8
|
primary: (s: string) => string;
|
|
@@ -23,8 +23,18 @@ export class TUI {
|
|
|
23
23
|
private static isTerminalTruncated = false;
|
|
24
24
|
private static currentTheme: TUIMode = 'dev';
|
|
25
25
|
|
|
26
|
-
static getModeTheme(mode: TUIMode): ModeTheme {
|
|
26
|
+
static getModeTheme(mode: TUIMode | 'augov'): ModeTheme {
|
|
27
27
|
switch (mode) {
|
|
28
|
+
case 'augov':
|
|
29
|
+
return {
|
|
30
|
+
primary: chalk.hex('#00008B'), // Dark Blue (Australian Flag)
|
|
31
|
+
secondary: chalk.hex('#005A9C'),
|
|
32
|
+
border: '║',
|
|
33
|
+
glow: chalk.hex('#ffffff'), // White
|
|
34
|
+
shadow: chalk.hex('#E4002B'), // Red (Australian Flag)
|
|
35
|
+
bg: '#00008B',
|
|
36
|
+
icon: '🇦🇺'
|
|
37
|
+
};
|
|
28
38
|
case 'study':
|
|
29
39
|
return {
|
|
30
40
|
primary: chalk.hex('#10b981'), // Emerald
|
|
@@ -138,7 +148,8 @@ export class TUI {
|
|
|
138
148
|
if (width <= 0 || height <= 0) return;
|
|
139
149
|
|
|
140
150
|
const theme = this.getModeTheme(this.currentTheme);
|
|
141
|
-
const
|
|
151
|
+
const branding = this.currentTheme === 'augov' ? 'AU-GOV' : 'MATEX';
|
|
152
|
+
const leftTag = chalk.bgHex('#1E1E1E').hex(theme.bg).bold(` ${theme.icon} ${branding} `);
|
|
142
153
|
const mainMessage = chalk.bgHex('#1E1E1E').white(` ${message} `);
|
|
143
154
|
const remainingWidth = width - (leftTag.length + mainMessage.length);
|
|
144
155
|
const spacer = chalk.bgHex('#1E1E1E')(' '.repeat(Math.max(0, remainingWidth)));
|
|
@@ -283,7 +294,9 @@ export class TUI {
|
|
|
283
294
|
const width = Math.min(process.stdout.columns || 80, 76);
|
|
284
295
|
const border = chalk.gray;
|
|
285
296
|
|
|
286
|
-
|
|
297
|
+
const title = this.currentTheme === 'augov' ? 'AU-GOV SECURE TERMINAL' : 'TERMINAL';
|
|
298
|
+
|
|
299
|
+
console.log('\n ' + border(`┌── ${title} ${'─'.repeat(Math.max(0, width - 15 - title.length))}┐`));
|
|
287
300
|
const truncatedCmd = command.length > width - 10 ? command.substring(0, width - 13) + '...' : command;
|
|
288
301
|
console.log(' ' + border('│ ') + chalk.cyan(`$ ${truncatedCmd.padEnd(width - 6)}`) + border(' │'));
|
|
289
302
|
console.log(' ' + border(`├${'─'.repeat(width - 4)}┤`));
|