@darkrymit/crunes-cli 0.5.1 → 0.5.2
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.js +90 -35
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -86615,44 +86615,99 @@ var init_intro_compiler = __esm({
|
|
|
86615
86615
|
init_formatter();
|
|
86616
86616
|
init_permissions();
|
|
86617
86617
|
NAMESPACE_RECIPES = {
|
|
86618
|
-
fs: `\`\`\`
|
|
86619
|
-
|
|
86620
|
-
|
|
86621
|
-
|
|
86618
|
+
fs: `\`\`\`javascript
|
|
86619
|
+
import { fs } from '@utils'
|
|
86620
|
+
|
|
86621
|
+
export async function use() {
|
|
86622
|
+
// Read and write files relative to the project root
|
|
86623
|
+
const content = await fs.read('src/components/Button.jsx');
|
|
86624
|
+
await fs.write('dist/output.txt', 'Hello Sandbox!');
|
|
86625
|
+
return 'File written successfully!';
|
|
86626
|
+
}
|
|
86622
86627
|
\`\`\``,
|
|
86623
|
-
ws: `\`\`\`
|
|
86624
|
-
|
|
86625
|
-
|
|
86626
|
-
|
|
86627
|
-
socket.
|
|
86628
|
-
|
|
86629
|
-
|
|
86630
|
-
|
|
86631
|
-
|
|
86628
|
+
ws: `\`\`\`javascript
|
|
86629
|
+
import { ws, section } from '@utils'
|
|
86630
|
+
|
|
86631
|
+
export async function use() {
|
|
86632
|
+
const socket = ws.client('ws://localhost:8080');
|
|
86633
|
+
const messages = [];
|
|
86634
|
+
|
|
86635
|
+
// Register event listeners BEFORE opening
|
|
86636
|
+
socket.on('message', (msg) => {
|
|
86637
|
+
messages.push(msg);
|
|
86638
|
+
});
|
|
86639
|
+
|
|
86640
|
+
await socket.open();
|
|
86641
|
+
await socket.sendText(JSON.stringify({ type: 'PING' }));
|
|
86642
|
+
|
|
86643
|
+
// Wait a moment for replies, then close
|
|
86644
|
+
await socket.close();
|
|
86645
|
+
|
|
86646
|
+
return [
|
|
86647
|
+
section.create('ws-replies', {
|
|
86648
|
+
type: 'markdown',
|
|
86649
|
+
content: messages.map(m => \`- \${m}\`).join('\\n')
|
|
86650
|
+
})
|
|
86651
|
+
];
|
|
86652
|
+
}
|
|
86632
86653
|
\`\`\``,
|
|
86633
|
-
sqlite: `\`\`\`
|
|
86634
|
-
|
|
86635
|
-
|
|
86636
|
-
|
|
86637
|
-
|
|
86638
|
-
const
|
|
86654
|
+
sqlite: `\`\`\`javascript
|
|
86655
|
+
import { sqlite, crypto, section } from '@utils'
|
|
86656
|
+
|
|
86657
|
+
export async function use() {
|
|
86658
|
+
// Scoped SQLite operations
|
|
86659
|
+
const db = await sqlite.open('@project-sqlite', 'my-database');
|
|
86660
|
+
await db.exec('CREATE TABLE IF NOT EXISTS logs (id TEXT PRIMARY KEY, msg TEXT)');
|
|
86661
|
+
await db.exec('INSERT INTO logs VALUES (?, ?)', [crypto.uuid(), 'Rune executed!']);
|
|
86662
|
+
const rows = await db.query('SELECT * FROM logs');
|
|
86663
|
+
|
|
86664
|
+
return [
|
|
86665
|
+
section.create('db-logs', {
|
|
86666
|
+
type: 'markdown',
|
|
86667
|
+
content: rows.map(r => \`- [\${r.id}]: \${r.msg}\`).join('\\n')
|
|
86668
|
+
})
|
|
86669
|
+
];
|
|
86670
|
+
}
|
|
86639
86671
|
\`\`\``,
|
|
86640
|
-
http: `\`\`\`
|
|
86641
|
-
|
|
86642
|
-
|
|
86643
|
-
|
|
86644
|
-
|
|
86672
|
+
http: `\`\`\`javascript
|
|
86673
|
+
import { http, section } from '@utils'
|
|
86674
|
+
|
|
86675
|
+
export async function use() {
|
|
86676
|
+
// Fetch from permitted hosts
|
|
86677
|
+
const response = await http.fetch('https://api.github.com/repos/darkrymit/crunes');
|
|
86678
|
+
const repo = await response.json();
|
|
86679
|
+
|
|
86680
|
+
return [
|
|
86681
|
+
section.create('github-repo', {
|
|
86682
|
+
type: 'markdown',
|
|
86683
|
+
content: \`**Repo Description**: \${repo.description}\`
|
|
86684
|
+
})
|
|
86685
|
+
];
|
|
86686
|
+
}
|
|
86645
86687
|
\`\`\``,
|
|
86646
|
-
cache: `\`\`\`
|
|
86647
|
-
|
|
86648
|
-
|
|
86649
|
-
|
|
86650
|
-
const
|
|
86688
|
+
cache: `\`\`\`javascript
|
|
86689
|
+
import { cache } from '@utils'
|
|
86690
|
+
|
|
86691
|
+
export async function use() {
|
|
86692
|
+
const projectCache = await cache.open('@project-cache');
|
|
86693
|
+
await projectCache.set('last-run', Date.now(), 60); // 60s TTL
|
|
86694
|
+
const lastRun = await projectCache.get('last-run');
|
|
86695
|
+
return \`Last run timestamp: \${lastRun}\`;
|
|
86696
|
+
}
|
|
86651
86697
|
\`\`\``,
|
|
86652
|
-
shell: `\`\`\`
|
|
86653
|
-
|
|
86654
|
-
|
|
86655
|
-
|
|
86698
|
+
shell: `\`\`\`javascript
|
|
86699
|
+
import { shell, section } from '@utils'
|
|
86700
|
+
|
|
86701
|
+
export async function use() {
|
|
86702
|
+
// Run command relative to the project directory
|
|
86703
|
+
const stdout = await shell.exec('git status --short');
|
|
86704
|
+
return [
|
|
86705
|
+
section.create('git-status', {
|
|
86706
|
+
type: 'markdown',
|
|
86707
|
+
content: \`\\\`\\\`\\\`\\n\${stdout}\\n\\\`\\\`\\\`\`
|
|
86708
|
+
})
|
|
86709
|
+
];
|
|
86710
|
+
}
|
|
86656
86711
|
\`\`\``
|
|
86657
86712
|
};
|
|
86658
86713
|
}
|
|
@@ -86710,7 +86765,7 @@ var init_package = __esm({
|
|
|
86710
86765
|
"package.json"() {
|
|
86711
86766
|
package_default = {
|
|
86712
86767
|
name: "@darkrymit/crunes-cli",
|
|
86713
|
-
version: "0.5.
|
|
86768
|
+
version: "0.5.2",
|
|
86714
86769
|
description: "CLI tool for querying crunes enrichers",
|
|
86715
86770
|
type: "module",
|
|
86716
86771
|
bin: {
|
|
@@ -92170,7 +92225,7 @@ var {
|
|
|
92170
92225
|
init_output();
|
|
92171
92226
|
function buildProgram() {
|
|
92172
92227
|
const program3 = new Command();
|
|
92173
|
-
program3.name("crunes").description("CLI tool for managing context runes").version("0.5.
|
|
92228
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.5.2", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
|
|
92174
92229
|
program3.hook("preAction", (_thisCommand, actionCommand) => {
|
|
92175
92230
|
configure({ plain: !!program3.opts().plain, verbose: !!program3.opts().verbose });
|
|
92176
92231
|
if (program3.opts().verbose) {
|