@taj-special/dravix-code 1.1.10 → 1.1.12
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/cli/repl.js +2 -89
- package/dist/services/context.js +4 -0
- package/dist/services/executor.js +8 -3
- package/package.json +1 -1
package/dist/cli/repl.js
CHANGED
|
@@ -8,87 +8,8 @@ import { parseOps, executeSingleOp, computeDiff } from '../services/executor.js'
|
|
|
8
8
|
import { handleCommand } from './commands.js';
|
|
9
9
|
import { printOpResult, printError, printInfo, colors } from '../utils/display.js';
|
|
10
10
|
import { saveConversation, loadConversation, listConversations, generateTitle, generateId } from '../services/conversations.js';
|
|
11
|
-
import { getToken
|
|
11
|
+
import { getToken } from '../services/auth.js';
|
|
12
12
|
import { checkUsage, reportUsage, estimateTokens, usageBar, fmtNum, formatResetTime } from '../services/usage.js';
|
|
13
|
-
// System prompt is fetched from server at runtime — not stored in this package
|
|
14
|
-
const BASE_PROMPT = ``;
|
|
15
|
-
// Critical behavioral rules — always injected into system prompt for every session
|
|
16
|
-
const BEHAVIORAL_RULES = `
|
|
17
|
-
|
|
18
|
-
## EXECUTE IMMEDIATELY — never ask what to do, never explain before acting.
|
|
19
|
-
|
|
20
|
-
## FILE OPERATIONS — use these exact tag formats:
|
|
21
|
-
|
|
22
|
-
### READ a file (when content not yet provided):
|
|
23
|
-
<read_file path="filename"/>
|
|
24
|
-
|
|
25
|
-
### CHANGE something:
|
|
26
|
-
<edit_file path="file.js">
|
|
27
|
-
<find>
|
|
28
|
-
exact old text copied from file
|
|
29
|
-
</find>
|
|
30
|
-
<replace>
|
|
31
|
-
new text goes here
|
|
32
|
-
</replace>
|
|
33
|
-
</edit_file>
|
|
34
|
-
|
|
35
|
-
### DELETE something — <replace> tag is COMPLETELY EMPTY, no spaces, no newlines inside:
|
|
36
|
-
<edit_file path="file.js">
|
|
37
|
-
<find>
|
|
38
|
-
exact text to remove copied from file
|
|
39
|
-
</find>
|
|
40
|
-
<replace></replace>
|
|
41
|
-
</edit_file>
|
|
42
|
-
|
|
43
|
-
### CREATE or fully rewrite a file:
|
|
44
|
-
<write_file path="file.js">
|
|
45
|
-
full file content here
|
|
46
|
-
</write_file>
|
|
47
|
-
|
|
48
|
-
### RUN a command:
|
|
49
|
-
<run_command>command here</run_command>
|
|
50
|
-
|
|
51
|
-
### ACTIVATE Web Designer mode — MANDATORY before building any website, UI, or HTML file:
|
|
52
|
-
BEFORE writing any HTML/CSS/JS, you MUST output this tag first:
|
|
53
|
-
<design_mode>
|
|
54
|
-
Modern responsive layout
|
|
55
|
-
Clean typography and spacing
|
|
56
|
-
Professional color palette
|
|
57
|
-
Smooth animations and transitions
|
|
58
|
-
Mobile-first design
|
|
59
|
-
</design_mode>
|
|
60
|
-
List design features relevant to the project inside the tag. Only after this tag, proceed to build with <write_file>.
|
|
61
|
-
|
|
62
|
-
## RULES:
|
|
63
|
-
- File content labeled [File: name — FULL] is already provided — use it, do NOT read again.
|
|
64
|
-
- Copy <find> text CHARACTER BY CHARACTER from the actual file — never write from memory.
|
|
65
|
-
- Include enough surrounding lines so <find> matches exactly ONE location.
|
|
66
|
-
- DELETE = <replace></replace> with nothing inside — if you put anything inside, it is NOT a delete.
|
|
67
|
-
- "Found N identical occurrences" → add more lines to <find> until it is unique.
|
|
68
|
-
|
|
69
|
-
## PERSONALITY & COMMUNICATION:
|
|
70
|
-
- Be warm, friendly, and professional — like a skilled teammate who enjoys the work.
|
|
71
|
-
- Before acting: one short sentence saying what you are about to do — write it in the SAME language the user used.
|
|
72
|
-
- After acting: confirm what was done in a natural, friendly tone — in the SAME language the user used.
|
|
73
|
-
- If the task is interesting or you notice something worth mentioning (a side effect, a tip, a related thing), say it briefly.
|
|
74
|
-
- CRITICAL: Detect the user's language from their message and use that EXACT language for your entire response. Tajik → Tajik. Russian → Russian. English → English. This applies to ALL messages including when doing file operations.`;
|
|
75
|
-
// Full prompt used when server returns empty
|
|
76
|
-
const FALLBACK_PROMPT = `You are Dravix Code — a hyper-professional AI coding assistant running in the terminal.
|
|
77
|
-
You are an elite software engineer who takes immediate, precise action on every request.
|
|
78
|
-
|
|
79
|
-
Core identity:
|
|
80
|
-
- You write production-quality code with no unnecessary comments or fluff
|
|
81
|
-
- You take action first, explain only when absolutely necessary
|
|
82
|
-
- You handle any language: TypeScript, JavaScript, Python, Go, Rust, HTML/CSS, SQL, and more
|
|
83
|
-
- You work on any project type: web apps, mobile apps, CLIs, APIs, databases, scripts
|
|
84
|
-
|
|
85
|
-
${BEHAVIORAL_RULES}`;
|
|
86
|
-
// prompts removed
|
|
87
|
-
// Removed — fetched from server
|
|
88
|
-
const CREATOR_EXTRA = ``;
|
|
89
|
-
// Removed — fetched from server at runtime
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
-
function buildSystemPrompt(_userEmail) { return BASE_PROMPT; }
|
|
92
13
|
let _serverWebDesignerSkill = '';
|
|
93
14
|
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
94
15
|
const SLASH_COMMANDS = [
|
|
@@ -2206,21 +2127,13 @@ async function showDesignModeLoader(skills) {
|
|
|
2206
2127
|
}
|
|
2207
2128
|
export async function startRepl(cwd) {
|
|
2208
2129
|
const alwaysAllowed = new Set();
|
|
2209
|
-
const { email: userEmail } = getSavedUser();
|
|
2210
|
-
// Fetch system prompt from server — never stored in package
|
|
2211
2130
|
const token = getToken() ?? '';
|
|
2212
2131
|
let SYSTEM_PROMPT = '';
|
|
2213
2132
|
if (token) {
|
|
2214
2133
|
const { prompt, webDesignerSkill } = await fetchSystemPrompt(token);
|
|
2215
|
-
|
|
2216
|
-
SYSTEM_PROMPT = prompt
|
|
2217
|
-
? prompt + '\n' + BEHAVIORAL_RULES
|
|
2218
|
-
: FALLBACK_PROMPT;
|
|
2134
|
+
SYSTEM_PROMPT = prompt;
|
|
2219
2135
|
_serverWebDesignerSkill = webDesignerSkill;
|
|
2220
2136
|
}
|
|
2221
|
-
else {
|
|
2222
|
-
SYSTEM_PROMPT = FALLBACK_PROMPT;
|
|
2223
|
-
}
|
|
2224
2137
|
// activeCwd can change when /resume loads a conversation from a different directory
|
|
2225
2138
|
let activeCwd = cwd;
|
|
2226
2139
|
const buildSystemMsg = (dir) => ({
|
package/dist/services/context.js
CHANGED
|
@@ -119,8 +119,12 @@ export function buildContext(root) {
|
|
|
119
119
|
const files = getProjectFiles(root);
|
|
120
120
|
const git = getGitStatus(root);
|
|
121
121
|
const projectName = path.basename(root);
|
|
122
|
+
const shell = process.platform === 'win32' ? 'Windows — PowerShell'
|
|
123
|
+
: process.platform === 'darwin' ? 'macOS — bash/zsh'
|
|
124
|
+
: 'Linux — bash';
|
|
122
125
|
return `Project: ${projectName}
|
|
123
126
|
Working dir: ${root}
|
|
127
|
+
OS: ${shell}
|
|
124
128
|
Git status:
|
|
125
129
|
${git || '(clean)'}
|
|
126
130
|
Files:
|
|
@@ -405,10 +405,15 @@ export async function executeSingleOp(op, cwd, onStage) {
|
|
|
405
405
|
const safeCmd = /(?:^|\s)npx\s+(?!--yes\b)/i.test(op.command)
|
|
406
406
|
? op.command.replace(/(?<=(?:^|\s))npx(\s+)/i, 'npx --yes$1')
|
|
407
407
|
: op.command;
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
const isWindows = process.platform === 'win32';
|
|
409
|
+
// On PowerShell 5.1, 'curl' is an alias for Invoke-WebRequest — use curl.exe for real HTTP
|
|
410
|
+
const finalCmd = isWindows
|
|
411
|
+
? safeCmd.replace(/\bcurl\b(?!\.\w)/g, 'curl.exe')
|
|
412
|
+
: safeCmd;
|
|
410
413
|
const out = await new Promise((res, rej) => {
|
|
411
|
-
const child =
|
|
414
|
+
const child = isWindows
|
|
415
|
+
? spawn('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', finalCmd], { cwd: runCwd, windowsHide: true })
|
|
416
|
+
: spawn('bash', ['-c', finalCmd], { cwd: runCwd });
|
|
412
417
|
child.stdout?.setEncoding('utf-8');
|
|
413
418
|
child.stderr?.setEncoding('utf-8');
|
|
414
419
|
let stdout = '';
|