### Create Installer Package Source: https://github.com/twop/shelv/blob/main/RELEASES.md Creates a macOS installer package (.pkg) from the signed application bundle, using a specific installer signing identity. This package is used for distributing the application. ```shell productbuild --sign "3rd Party Mac Developer Installer" --component target/release/bundle/osx/Shelv.app /Applications target/release/bundle/osx/Shelv.pkg ``` -------------------------------- ### File System Structure Example Source: https://github.com/twop/shelv/blob/main/docs/notes/post-live-blocks--plan.md This example illustrates a typical file system layout for the 'shelv' project, including note files (MDX format), a state management file (JSON), and an archive directory. It demonstrates how notes are organized and how archiving might be implemented. ```filesystem settings.mdx // these are 4 notes // note that "todos" can be taken from h1 todos-slippy-lemur.mdx note-fat-panda.mdx note-#t45f.mdx note-#t45f.mdx state.json // archive folder archive // after archiving -> todos-slippy-lemur.mdx ``` -------------------------------- ### Configure Settings with JavaScript Source: https://github.com/twop/shelv/blob/main/CLAUDE.md This snippet pertains to the configuration of application settings through JavaScript. It highlights the flexibility of using scripts for managing application behavior. ```rust // settings_eval.rs // Settings configuration via JavaScript ``` -------------------------------- ### Submit Shelv Installer for Notarization Source: https://github.com/twop/shelv/blob/main/RELEASES.md Submits the Shelv installer package (.pkg) to Apple's notary service for notarization. This process verifies that the code is free from known malware. Requires issuer ID, key ID, and a private key file. ```shell xcrun notarytool submit --issuer "804cc69c-4df1-44ae-b829-c8d144aea43d" --key-id "HRG65U3FX8" --key ~/.appstoreconnect/private_keys/AuthKey_HRG65U3FX8.p8 target/release/bundle/osx/Shelv.pkg ``` -------------------------------- ### Rust Syntax Highlighting Example Source: https://github.com/twop/shelv/blob/main/README.md This snippet demonstrates basic syntax highlighting for Rust code within the Shelv application. It shows how to print a string to the console. ```rust println!("Just syntax highlighted") ``` -------------------------------- ### Example KDL Configuration for Shelv Settings Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Illustrates how Shelv settings, including keybindings, are defined using the KDL language within a settings note. This allows for immediate application of changes and customization of app behavior. ```kdl {{current_keybindings}} ``` -------------------------------- ### Create Shelv Installer Package Source: https://github.com/twop/shelv/blob/main/RELEASES.md Creates an installer package (.pkg) for the Shelv macOS application using the 'Developer ID Installer' identity. This package can then be distributed to users. ```shell productbuild --sign "Developer ID Installer" --component target/release/bundle/osx/Shelv.app /Applications target/release/bundle/osx/Shelv.pkg ``` -------------------------------- ### Staple Shelv Installer Package Source: https://github.com/twop/shelv/blob/main/RELEASES.md Staples the notarized Shelv installer package. Stapling allows users to install the application offline without triggering security warnings about the developer's identity, as it embeds the notarization ticket within the package. ```shell xcrun stapler staple -v target/release/bundle/osx/Shelv.pkg ``` -------------------------------- ### Rust Example: Implementing Chat with async-openai Source: https://github.com/twop/shelv/blob/main/docs/notes/useful-tech-links.md This Rust code illustrates how to build a chat application using the async-openai library, an unofficial Rust SDK for the OpenAI API. It demonstrates making asynchronous requests to the chat completions endpoint, providing a foundation for AI-powered conversational agents. ```rust async fn run() -> Result<()> { let client = Client::new(); let response = client .chat() .create( "gpt-3.5-turbo", vec![Message { role: Role::User, content: "Hello!".to_string(), }], ) .await?; println!("{:?}", response); Ok(()) } ``` -------------------------------- ### Run and Check Rust Code with Cargo Source: https://github.com/twop/shelv/blob/main/CLAUDE.md Standard commands for building, running, and checking Rust code within the repository. `cargo run` executes the application, while `cargo check` provides a faster way to verify code correctness without full compilation. ```bash cargo run cargo check ``` -------------------------------- ### Rust Example: Loading an LLM Model with Candle Source: https://github.com/twop/shelv/blob/main/docs/notes/useful-tech-links.md This Rust code snippet demonstrates how to load a language model using the Candle library. It highlights the integration with Hugging Face's ecosystem for AI applications. The function `load_model` takes a model path and configuration to initialize the model. ```rust pub fn load_model( model_path: &str, config: &Config, ) -> Result, AnyError> { let device = Device::Cpu; let mut D = falcon::Model::load(model_path, &device)?; Ok(Some(D.var_store)) } ``` -------------------------------- ### Rust Example: Candle Whisper Audio to Text Source: https://github.com/twop/shelv/blob/main/docs/notes/useful-tech-links.md This Rust code snippet showcases the use of the Candle library for the Whisper model to perform audio-to-text transcription. It provides a practical example of implementing speech recognition within a Rust application using pre-trained models from Hugging Face. ```rust fn main() -> anyhow::Result<()> { let model = CandleRunner::new("whisper-tiny.gguf", true)?; let wave = load_wave(&Path::new("test.wav"))?; let transcript = model.transcribe(&wave)?; println!("{}", transcript); Ok(()) } ``` -------------------------------- ### JSON State Management Example Source: https://github.com/twop/shelv/blob/main/docs/notes/post-live-blocks--plan.md This JSON snippet represents the state management file for 'shelv'. It includes an array of notes, with each note identified by its ID and cursor position. This structure is crucial for saving and restoring user progress and session data. ```json { notes: [ {id: "note-slippy-lemur.mdx", cursor: [1,45]}, {id: "note-fat-panda.mdx", cursor: [1,45]}, ] } ``` -------------------------------- ### Configure AI Model and System Prompt in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-settings.md This snippet shows how to configure AI settings within Shelv. It allows you to select an AI model (e.g., 'claude-3-haiku-20240307') and define a system prompt to guide the AI's behavior. The system prompt should be a raw string. Ensure the chosen model is accessible. ```settings ai { model "claude-3-haiku-20240307" // Or "claude-3-5-sonnet-20240620" systemPrompt r#"\ You are a helpful assistant in tech. Be very concise with your answers "# } ``` -------------------------------- ### Find Code Signing Identities with `security find-identity` Source: https://github.com/twop/shelv/blob/main/RELEASES.md This command lists all available code signing identities on your system, including their IDs and common names. It also shows which identities are considered 'valid' for signing purposes, which depends on having the correct root certificates installed. Ensure your identities are listed as valid before proceeding with distribution. ```shell security find-identity ``` -------------------------------- ### JavaScript Code Snippet (No Output) Source: https://github.com/twop/shelv/blob/main/docs/notes/post-live-blocks--plan.md This JavaScript code block is intended not to produce any output. It serves as an example of how to define non-outputting blocks within the system. No specific dependencies are required beyond a JavaScript runtime. ```javascript // this does not generate output ``` ```javascript // this does not generate output ``` -------------------------------- ### Integrate AI/LLM as a Code Block in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/yc-application.md Shelv supports integrating AI (LLM) as a special code block type, denoted by `llm`. This allows for context-aware AI interactions directly within notes. No specific code example is provided as it depends on the LLM API integration. ```markdown This is a note about AI. ```llm Summarize the previous paragraph. ``` ``` -------------------------------- ### Provide Script Execution Context Source: https://github.com/twop/shelv/blob/main/CLAUDE.md This snippet defines the context within which JavaScript scripts are executed. It's crucial for managing variables, functions, and the overall environment available to the scripts. ```rust // note_eval_context.rs // Context for script execution ``` -------------------------------- ### Execute Rust Tests with Cargo Source: https://github.com/twop/shelv/blob/main/CLAUDE.md This command utilizes Rust's standard tooling to run all defined tests within the project. It's essential for ensuring code integrity and functionality. ```bash cargo test ``` -------------------------------- ### Evaluate JavaScript Code Blocks in Notes Source: https://github.com/twop/shelv/blob/main/CLAUDE.md This snippet represents the mechanism for executing JavaScript code embedded within notes using the Boa engine. It demonstrates how live code blocks are evaluated within the application's context. ```rust // note_eval.rs // JavaScript code block evaluation within notes ``` -------------------------------- ### Format Current Date (JavaScript) Source: https://github.com/twop/shelv/blob/main/distribution/assets/for_app_store/screenshot-3.md Provides a JavaScript function to get the current date formatted as YYYY/mon/DD. It uses a predefined array for month names and ensures the day is always two digits. ```javascript const monthNames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; export function getCurrentDate() { const now = new Date(); const year = now.getFullYear(); const month = monthNames[now.getMonth()]; // Ensures the day is 2 digits, adding leading zero if needed(2, '0'); const day = String(now.getDate()).padStart(2, '0'); return `${year}/${month}/${day}`; } ``` -------------------------------- ### Get Current Day of Week JavaScript Function (JS) Source: https://github.com/twop/shelv/blob/main/README.md A JavaScript function that returns the current day of the week. This function can be called from KDL using the InsertText command with callFunc. ```javascript export function getCurrentDayOfWeek() { const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; const now = new Date(); return days[now.getDay()]; } ``` -------------------------------- ### Interconnected JavaScript Blocks in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-3.md JavaScript code blocks in Shelv can reference previously defined functions from other blocks within the same note. This enables modularity and complex interactions. The example demonstrates calling the `hi` function defined in a prior block. ```javascript ``` -------------------------------- ### Settings: Displaying All Shortcuts on Modification Source: https://github.com/twop/shelv/blob/main/docs/meetings/standup-09-11-2024.md This describes an idea for the settings feature: if a user modifies a shortcut, the system should print out all shortcuts. This is intended to improve discoverability of default shortcuts, even if it means displaying them multiple times. ```pseudocode If you modify a shortcut in settings, print out all shortcuts Its okay if it happens multiple times ``` -------------------------------- ### Upload App Build with altool Source: https://github.com/twop/shelv/blob/main/RELEASES.md Uploads the validated application package to App Store Connect using the altool command-line utility. This makes the build available for further testing or release. ```shell xcrun altool --upload-app -f target/release/bundle/osx/Shelv.pkg -t macos --apiKey "HRG65U3FX8" --apiIssuer "804cc69c-4df1-44ae-b829-c8d144aea43d" ``` -------------------------------- ### Inspect Binary Dependencies with otool Source: https://github.com/twop/shelv/blob/main/RELEASES.md Uses the 'otool' utility to list the dynamic shared library dependencies of the application binary. This can help identify unexpected library linkages. ```shell otool -L target/release/bundle/osx/Shelv.app/Contents/MacOS/shelv ``` -------------------------------- ### Twop Shelv: In-App Keybinding Configuration Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Configures in-app keybindings for Shelv, allowing users to map shortcuts to specific actions. Optional attributes like 'icon', 'alias', and 'description' can be provided for slash palette integration. Supports various Markdown actions, window manipulation, AI interactions, and text insertion. ```shelv_config bind "Shortcut" { Action; icon: "gear"; alias: "CommandName"; description: "Command description"; } ``` -------------------------------- ### Build Release Bundle with Cargo Source: https://github.com/twop/shelv/blob/main/RELEASES.md Builds a release-optimized bundle for the application using the Cargo build tool. This is the initial step in creating a deployable artifact. ```shell cargo bundle --release ``` -------------------------------- ### Build and Test Rust Application Source: https://github.com/twop/shelv/blob/main/README.md Commands to build and run the Rust application, as well as execute its tests. These are fundamental commands for developers working with the Rust ecosystem. ```bash # Run the application cargo run # Run tests cargo test ``` -------------------------------- ### Shelv's Hackable Settings and Custom Workflows Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/yc-application.md Shelv's settings are managed through markdown notes, allowing users to customize workflows and introduce new features, such as parameterized snippets or custom code block types like Rust. This demonstrates Shelv's extensibility. ```markdown # Custom Snippet Example ## Parameterized Greeting ```parameterized_snippet Hello, {{name}}! ``` ## Rust Code Block (Hypothetical) ```rust fn main() { println!("Hello from Rust!"); } ``` ``` -------------------------------- ### Define Global Shortcut in KDL Source: https://github.com/twop/shelv/blob/main/src/default-notes/default-settings.md This KDL snippet demonstrates how to define a global shortcut for the 'ShowHideApp' command. It specifies the key combination (Cmd Option S) and the associated action. This allows users to quickly trigger application functions. ```kdl // All changes inside kdl and js blocks will apply immediately! // Format: `global "[key1] [key2] ..." {ShortcutName;}` // Alt keys: Shift (⇧), Cmd (⌘), Option (⌥), Ctrl (⌃), Enter (⏎) // Alpha-numeric keys: A-Z or `0-9` global "Cmd Option S" {ShowHideApp;} ``` -------------------------------- ### Shelv Tech Stack - Rust Ecosystem Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/yc-application.md Details the core technologies used in Shelv's development, highlighting the use of Rust for performance and reliability, Automerge for CRDT capabilities, Axum for the server-side, and egui for the GUI. ```plaintext Rust GUI toolkit (www.egui.rs) ``` ```plaintext Automerge (CRDT) ``` ```plaintext Axum on the server ``` -------------------------------- ### Create Custom Command for Markdown Link in KDL Source: https://github.com/twop/shelv/blob/main/src/default-notes/default-settings.md This KDL snippet defines a custom command triggered by 'Cmd K' to insert a Markdown link. It utilizes placeholders like '{{selection}}' for selected text and '{||}' for cursor positioning, enabling dynamic link creation. ```kdl // (Cmd K): Insert Markdown Link // you can find more icon names here: https://phosphoricons.com/ bind "Cmd K" icon="link" alias="link" description="Insert Markdown Link" { InsertText { string "[{{selection}}]({||})" } } ``` -------------------------------- ### Insert Markdown Link with Magic Strings Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This KDL snippet demonstrates using magic strings within the `InsertText` command to create a Markdown link. `{{selection}}` inserts the selected text, and `{||}` places the cursor at a specific point after insertion. ```kdl // (Cmd K): Insert Markdown Link bind "Cmd K" icon="link" alias="link" description="Insert Markdown Link" { InsertText { string "[{{selection}}]({||})" } } ``` -------------------------------- ### Check Private API Usage with nm Source: https://github.com/twop/shelv/blob/main/RELEASES.md Uses the 'nm' utility to dump symbols from the binary, specifically looking for references to 'CGSSetWindowBackgroundBlurRadius', which may indicate private API usage and lead to App Store rejection. ```shell nm -u target/release/bundle/osx/Shelv.app/Contents/MacOS/shelv | grep CGSSetWindowBackgroundBlurRadius ``` -------------------------------- ### Twop Shelv: AI Settings Configuration Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Optional configuration block for AI-related settings in Shelv. Allows specification of the AI model, custom system prompts, API tokens, and control over using Shelv's default system prompt. ```shelv_config ai { model: "string"; systemPrompt: "string"; token: "string"; useShelvSystemPrompt: true; } ``` -------------------------------- ### Twop Shelv: Global Shortcut Configuration Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Defines system-wide keyboard shortcuts for Shelv. Shortcuts are defined using a 'Modifier1 Modifier2 Key' format, where modifiers can be Cmd, Option, Shift, or Ctrl. Available actions include 'ShowHideApp'. ```shelv_config global "Shortcut" { Action; } ``` -------------------------------- ### Import Shelv Plugin Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/shelv-api-ideas.md Imports a plugin for Shelv from a specified URL, likely a GitHub Gist. This allows extending Shelv's functionality with custom code. ```typescript importShelv("gist.githumb.com/some-plugin..."); ``` -------------------------------- ### Execute JavaScript in Shelv Source: https://github.com/twop/shelv/blob/main/src/default-notes/tutorial.md Shelv allows for live execution of JavaScript code blocks. This feature enables users to perform quick calculations or run small programs directly within the app. To execute, click the run button or use the 'Cmd + Enter' shortcut within the code block. ```javascript const days = 4 const workingHours = 8 days * workingHours ``` -------------------------------- ### Embed Provision Profile Source: https://github.com/twop/shelv/blob/main/RELEASES.md Copies the downloaded provisioning profile into the application bundle's Contents directory. This profile is essential for code signing and distribution. ```shell cp ~/Downloads/mac_app_store_prov_profile.provisionprofile target/release/bundle/osx/Shelv.app/Contents/embedded.provisionprofile ``` -------------------------------- ### Insert Static Text with InsertText Command Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This snippet demonstrates how to insert a static string directly into a note using the `InsertText` command. It's a straightforward method for predefined text insertion. ```kdl bind "Cmd T" icon="text-aa" alias="test" description="Insert test text" { InsertText { string "This is a test" } } ``` -------------------------------- ### Code Sign Application Source: https://github.com/twop/shelv/blob/main/RELEASES.md Signs the application bundle using a specified signing identity and entitlements file. This step verifies the application's integrity and authenticity. ```shell codesign --sign "3rd Party Mac Developer Application" --entitlements distribution/entitlements.xml -v target/release/bundle/osx/Shelv.app ``` -------------------------------- ### Shelv Default AI Settings (KDL) Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Defines the default AI settings for Shelv, including the model to be used and whether to append the Shelv context to the system prompt. This KDL configuration allows for customization of AI behavior within the application. ```kdl ai { // By default Shelv will use rate limited haiku 3.5 // but you can provide your own API key for many providers including Ollama model "shelv-claude" // default is set to true, meaning that the Shelv context will be appended to your system prompt useShelvSystemPrompt true } ``` -------------------------------- ### Configure Shelv Settings and Commands Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/shelv-api-ideas.md Defines global settings and registers custom editor commands for Shelv. This snippet demonstrates how to set font size and create a new JavaScript code block via a keyboard shortcut. ```typescript { settings: { fontSize: 12 }, commands: [ { type: "editor:command", name: "create js block", shortcut: "cmd + option + r", action: () => { Shelv.insert(Shelv.currentNote(), Shelv.cursor(), "\n```js\n{||}```\n"); } } ] } ``` -------------------------------- ### Assign Global Hotkey for ShowHideApp in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-settings.md This snippet demonstrates how to assign a custom global hotkey to show or hide the Shelv application. It modifies the key bindings for the `ShowHideApp` command. No external dependencies are required. ```settings global "Cmd Shift M" {ShowHideApp;} ``` -------------------------------- ### Import and Use Exported JavaScript Elements Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This JavaScript code block shows how previously exported variables and functions (like `hello` and `world`) are implicitly available and can be used to define new exported elements. ```javascript // note that imports are implicit export const greet = () => hello + " " + world() + "!"; ``` -------------------------------- ### Insert Static Text via InsertText Command (KDL) Source: https://github.com/twop/shelv/blob/main/README.md Demonstrates inserting a fixed string into a note using the InsertText command in KDL. This is useful for predefined phrases or templates. ```kdl bind "Cmd T" icon="text-aa" alias="test" description="Insert test text" { InsertText { string "This is a test" } } ``` -------------------------------- ### Bind Command to Insert Date (KDL) Source: https://github.com/twop/shelv/blob/main/distribution/assets/for_app_store/screenshot-3.md Defines a keyboard shortcut (Cmd Y) to insert the current date using the `getCurrentDate` function. This KDL configuration allows users to quickly insert formatted dates into their workflow. ```kdl // (⌘ Y): Insert result from: getCurrentDate bind "Cmd Y" icon="calendar" alias="date" description="Insert current date (YYYY/mon/DD)" { InsertText { callFunc "getCurrentDate" } } ``` -------------------------------- ### KDL Configuration for Shelv Shortcuts Source: https://github.com/twop/shelv/blob/main/README.md This KDL (KDL Markup Language) snippet defines custom keyboard shortcuts for various actions within Shelv. It illustrates how to bind key combinations to specific commands, including toggling Markdown elements, controlling the window, and switching notes. ```kdl // (⌥ ⌘ B): Toggle Code Block bind "Option Cmd B" icon="code-block" alias="code" description="Toggle Code Block" { MarkdownCodeBlock; } // (⌘ B): Toggle Bold bind "Cmd B" icon="text-b" alias="bold" description="Toggle Bold" { MarkdownBold; } // (⌘ I): Toggle Italic bind "Cmd I" icon="text-italic" alias="italic" description="Toggle Italic" { MarkdownItalic; } // (⇧ ⌘ E): Toggle Strikethrough bind "Shift Cmd E" icon="text-strikethrough" alias="strike" description="Toggle Strikethrough" { MarkdownStrikethrough; } // (⌥ ⌘ 1): Heading 1 bind "Option Cmd 1" icon="text-h-one" alias="h1" description="Heading 1" { MarkdownH1; } // (⌥ ⌘ 2): Heading 2 bind "Option Cmd 2" icon="text-h-two" alias="h2" description="Heading 2" { MarkdownH2; } // (⌥ ⌘ 3): Heading 3 bind "Option Cmd 3" icon="text-h-three" alias="h3" description="Heading 3" { MarkdownH3; } // (⌃ Enter): Show AI Prompt bind "Ctrl Enter" icon="sparkle" alias="ai" description="Show AI Prompt" { ShowPrompt; } // (⌘ ,): Open Settings bind "Cmd Comma" { SwitchToSettings; } // (⌘ P): Toggle Always on Top bind "Cmd P" { PinWindow; } // (Escape): Hide Window bind "Escape" { HideApp; } // (⌘ 1): Shelf 1 bind "Cmd 1" { SwitchToNote 0; } // (⌘ 2): Shelf 2 bind "Cmd 2" { SwitchToNote 1; } // (⌘ 3): Shelf 3 bind "Cmd 3" { SwitchToNote 2; } // (⌘ 4): Shelf 4 bind "Cmd 4" { SwitchToNote 3; } ``` -------------------------------- ### State JSON Structure - Version 1 (MVP) Source: https://github.com/twop/shelv/blob/main/docs/notes/file-system-persistence.md This JSON structure represents the state of the application in Version 1 (MVP). It includes the version number, the last save timestamp, and the currently selected note. This format is crucial for data migrations and syncing. ```json { // important for data migrations "version": 1, // timestamp, needed for bi-directional syncing of notes "lastSaved": 63245436, // note that it is zero based // and potentially can select other things like "selected": "settings" // TODO possibly encode it as "selected": "note:1" "selected": { "note": 0 } // TODO think about cursor positions within notes } ``` -------------------------------- ### Make Selection Uppercase Command (KDL) Source: https://github.com/twop/shelv/blob/main/README.md A KDL command that uses InsertText to call the 'makeUppercase' JavaScript function, converting the selected text to uppercase. ```kdl bind "Cmd U" icon="text-aa" alias="upper" description="Make selection uppercase" { InsertText { callFunc "makeUppercase" { selection } } } ``` -------------------------------- ### Add Plist Data with PlistBuddy Source: https://github.com/twop/shelv/blob/main/RELEASES.md Modifies the application's Info.plist file by adding specific build and platform information using the PlistBuddy command-line tool. This ensures the bundle metadata is correctly configured for release. ```shell /usr/libexec/PlistBuddy -c "Add :DTCompiler string com.apple.compilers.llvm.clang.1_0" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTPlatformBuild string 15F31d" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTPlatformName string macosx" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTPlatformVersion string 14.5" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTSDKBuild string 23F73" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTSDKName string macosx14.5" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTXcode string 1540" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :DTXcodeBuild string 15F31d" ./target/release/bundle/osx/Shelv.app/Contents/Info.plist ``` -------------------------------- ### Supported Code Block Types in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/yc-application.md This snippet lists the additional code block types that Shelv plans to support, including SQL, shell scripts, and Large Language Model (LLM) related code. ```markdown - More code blocks: `sql`, `sh`, `llm` etc ``` -------------------------------- ### Markdown Checklist Item Expansion Source: https://github.com/twop/shelv/blob/main/docs/meetings/standup-09-11-2024.md This snippet addresses an issue with markdown where `[] ` should consistently create a checklist item, regardless of soft breaks. It also notes that some `[]` expansions did not work as expected. ```markdown Some [] expansions did not work `[]` should always make a checklist item, fuck soft breaks ``` -------------------------------- ### Validate App Package with altool Source: https://github.com/twop/shelv/blob/main/RELEASES.md Validates the created application package using Apple's altool command-line utility. This is a crucial step to ensure the package meets App Store Connect requirements before uploading. ```shell xcrun altool --validate-app -f target/release/bundle/osx/Shelv.pkg -t macos --apiKey "HRG65U3FX8" --apiIssuer "804cc69c-4df1-44ae-b829-c8d144aea43d" ``` -------------------------------- ### State JSON Structure - Version 2 (Future) Source: https://github.com/twop/shelv/blob/main/docs/notes/file-system-persistence.md The state.json structure for Version 2 introduces an array to explicitly list note file names, allowing for a more ordered and managed collection. It also includes the version, last saved timestamp, and selected note, with plans for future enhancements like unique IDs within note names. ```json { // important for data migrations "version": 2, // timestamp, needed for bi-directional syncing of notes "lastSaved": 63245436, // note that order here matters // and potentially can be different from `note-1-{...}` "notes": [ "note-1-aty4dsaf.md", "note-2-yu435ga.md", "note-3-fsdffzf23.md", "note-4-fdsxdfbs.md" ], // note that it is zero based // and potentially can select other things "selected": { "note": 0 } } ``` -------------------------------- ### Insert Dynamic Text via JavaScript Function Call (KDL) Source: https://github.com/twop/shelv/blob/main/README.md Shows how to use the InsertText command to call a JavaScript function for dynamic text generation. The function must be exported from a 'js' code block in the settings note. ```kdl bind "Cmd T" { InsertText { callFunc "myFunction" } } ``` -------------------------------- ### Markdown Numbered Lists and Checklists in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-2.md Shows how to create numbered lists and incorporate checklists within them. Supports standard Markdown numbered list syntax and checkbox formatting `[]`. ```markdown 1. Numbered item 2. Another numbered item - [ ] Checklist item ``` -------------------------------- ### Bind Command to Wrap Selection in Quotes Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This KDL snippet binds a keyboard shortcut (Cmd Q) to wrap the currently selected text in double quotes using the `wrapInQuotes` JavaScript function via the `InsertText` command. ```kdl bind "Cmd Q" description="Wrap selection in quotes" { InsertText { callFunc "wrapInQuotes" { selection } } } ``` -------------------------------- ### Insert Dynamic Text via JavaScript Function Call Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This snippet shows how to insert dynamic text by calling a JavaScript function using the `InsertText` command. The `callFunc` directive specifies the exported JavaScript function to execute. ```kdl bind "Cmd T" { InsertText { text { callFunc "myFunction" } } } ``` -------------------------------- ### Export JavaScript Variables and Functions Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This JavaScript code block demonstrates how to export variables and functions from a JavaScript module. These exported elements can be implicitly imported and used in subsequent blocks. ```javascript export const hello = "Hello"; export function world() { return "World"; } ``` -------------------------------- ### Markdown Links in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-2.md Explains how Shelv automatically links URLs and supports the standard Markdown format for creating links: `[text](url)`. ```markdown Automatic link: https://shelv.app Markdown link: [Visit Shelv](https://shelv.app) ``` -------------------------------- ### Markdown Unordered Lists in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-2.md Demonstrates the use of '-', '*', or '+' for creating unordered lists and nesting them. Shelv supports standard Markdown list syntax for easy list management. ```markdown - Item 1 * Sub-item 1 + Sub-sub-item 1 ``` -------------------------------- ### Markdown Text Formatting in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-2.md Illustrates text formatting using Markdown syntax for bold ('*'), italics ('*'), and strikethrough ('~'). Shelv supports these common text emphasis styles. ```markdown **Bold text** *Italic text* ~~Strikethrough text~~ ``` -------------------------------- ### Call JavaScript Function with Selection Argument (KDL) Source: https://github.com/twop/shelv/blob/main/README.md Illustrates calling a JavaScript function with the currently selected text as an argument using the InsertText command. The 'selection' child node passes the selected text to the function. ```kdl bind "Cmd T" { InsertText { callFunc "myFunction" { selection } } } ``` -------------------------------- ### JavaScript Live Code Execution in Notes Source: https://github.com/twop/shelv/blob/main/README.md This snippet showcases live JavaScript code execution within Shelv notes. The code can be run directly, and its output is displayed below the code block, demonstrating dynamic behavior and live reload capabilities. ```javascript console.log('I can be run!'); new Map().set("with", "live reload") ``` -------------------------------- ### Wrap Selection in Quotes Command (KDL) Source: https://github.com/twop/shelv/blob/main/README.md A KDL command that uses InsertText to call the 'wrapInQuotes' JavaScript function, wrapping the selected text in double quotes. ```kdl bind "Cmd Q" icon="quotes" alias="quote" description="Wrap selection in quotes" { InsertText { callFunc "wrapInQuotes" { selection } } } ``` -------------------------------- ### InsertText Action in Shelv Source: https://github.com/twop/shelv/blob/main/README.md Demonstrates the 'InsertText' action for the 'bind' keyword in Shelv. This action allows inserting direct text strings, calling exported JavaScript functions, or calling them with arguments, supporting selection nodes. ```shelv InsertText { string "Direct text string" // OR to call a js function callFunc "exportedJsFunctionName" // OR to call a js function with arguments callFunc "exportedJsFunctionName" { selection // only selection node is currently supported } } ``` -------------------------------- ### Markdown Headers in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-2.md Demonstrates the creation of different header levels (H1, H2, H3) using the '#' prefix in Markdown. Shelv supports up to three levels of headers. ```markdown # Header 1 ## Header 2 ### Header 3 ``` -------------------------------- ### Twop Shelv: InsertText Action with JavaScript Function Call Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md Demonstrates the 'InsertText' action within Shelv configurations. This action can insert direct text strings or call exported JavaScript functions. It supports calling functions with or without arguments, including the current selection. ```shelv_config InsertText { string "Direct text string" } InsertText { callFunc "exportedJsFunctionName" } InsertText { callFunc "exportedJsFunctionName" { selection } } ``` -------------------------------- ### Extract Strings from Binary Source: https://github.com/twop/shelv/blob/main/RELEASES.md Uses the 'strings' utility to extract human-readable strings from the application binary. This can be useful for debugging or identifying embedded information. ```shell strings target/release/bundle/osx/Shelv.app/Contents/MacOS/shelv ``` -------------------------------- ### Bind Command to Insert Formatted Date Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This KDL snippet binds a keyboard shortcut (Cmd Y) to insert the current date formatted as YYYY/mon/DD using the `getCurrentDate` JavaScript function via the `InsertText` command. ```kdl // (⌘ Y): Insert result from: getCurrentDate bind "Cmd Y" icon="calendar-heart" alias="date" description="Insert current date (YYYY/mon/DD)" { InsertText { callFunc "getCurrentDate" } } ``` -------------------------------- ### Check Notarization History and Log Source: https://github.com/twop/shelv/blob/main/RELEASES.md Commands to check the history of notary submissions and retrieve the log for a specific submission. This is useful for monitoring the notarization process and diagnosing issues. ```shell xcrun notarytool history --issuer "804cc69c-4df1-44ae-b829-c8d144aea43d" --key-id "HRG65U3FX8" --key ~/.appstoreconnect/private_keys/AuthKey_HRG65U3FX8.p8 ``` ```shell xcrun notarytool log --issuer "804cc69c-4df1-44ae-b829-c8d144aea43d" --key-id "HRG65U3FX8" --key ~/.appstoreconnect/private_keys/AuthKey_HRG65U3FX8.p8 "{ID from previous command output}" ``` -------------------------------- ### Register Shelv Command Dynamically Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/shelv-api-ideas.md Registers a new editor command for Shelv, specifying its type, name, keyboard shortcut, and the action to perform. This allows for custom editor interactions. ```typescript Shelv.globalSettings.set("fontSize", 12); // register a command based on keyboard shortcuts Shelv.register({ type: "editor:command", name: "create js block", shortcut: "cmd + option + r", action: () => { Shelv.insert(Shelv.currentNote(), Shelv.cursor(), "\n```js\n{||}```\n"); }, }); ``` -------------------------------- ### Execute JavaScript Code Blocks Inline in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/yc-application.md Shelv allows users to embed and execute JavaScript code directly within their notes. This feature enables dynamic content generation and interactive elements. It requires the JavaScript runtime to be available. ```javascript console.log("Hello from Shelv!"); let x = 5; let y = 10; console.log(x + y); ``` -------------------------------- ### Insert Current Day of Week Command (KDL) Source: https://github.com/twop/shelv/blob/main/README.md A KDL command that uses InsertText to call the 'getCurrentDayOfWeek' JavaScript function, inserting the current day of the week into the note. ```kdl bind "Cmd D" icon="calendar" alias="day" description="Insert current day of the week" { InsertText { callFunc "getCurrentDayOfWeek" } } ``` -------------------------------- ### Pass Selection Argument to JavaScript Function Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This snippet illustrates how to pass the current text selection as an argument to a JavaScript function called via `InsertText`. This allows for context-aware text manipulation. ```kdl bind "Cmd T" { InsertText { callFunc "myFunction" { selection } } } ``` -------------------------------- ### Create JavaScript Block Function Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/shelv-api-ideas.md An exported JavaScript function intended for use within the Shelv environment, likely related to creating code blocks. It is an empty function definition. ```javascript export function createJsBlock() {} ``` -------------------------------- ### Generate Formatted Date with JavaScript Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This JavaScript code provides a function `getCurrentDate` that generates a formatted date string (YYYY/mon/DD). It also exports an array of month names for potential reuse. ```javascript // export month names for later reuse export const monthNames = [ "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", ]; // Function that returns a formatted date string export function getCurrentDate() { const now = new Date(); const year = now.getFullYear(); const month = monthNames[now.getMonth()]; const day = String(now.getDate()).padStart(2, "0"); return `${year}/${month}/${day}`; } ``` -------------------------------- ### JavaScript Functions for Text Manipulation (JS) Source: https://github.com/twop/shelv/blob/main/README.md Provides two JavaScript functions: 'wrapInQuotes' to enclose text in double quotes and 'makeUppercase' to convert text to uppercase. Both accept selected text as an argument. ```javascript export function wrapInQuotes(selectedText) { return `"${selectedText}"`; } export function makeUppercase(selectedText) { return selectedText.toUpperCase(); } ``` -------------------------------- ### JavaScript Code Snippet (Named Block Output) Source: https://github.com/twop/shelv/blob/main/docs/notes/post-live-blocks--plan.md This JavaScript code block, identified by a name (e.g., '#namedblock'), is designed to generate output. The content following the block definition is considered the output. This functionality allows for structured data or script execution. ```javascript #namedblock // this generates output fdsfsdfsdf ``` -------------------------------- ### Code Sign Shelv macOS Application Source: https://github.com/twop/shelv/blob/main/RELEASES.md Signs the Shelv macOS application bundle using the 'Developer ID Application' identity. This step is crucial for distributing applications outside the Mac App Store, ensuring authenticity and integrity. ```shell codesign --sign "Developer ID Application" --deep -v -f -o runtime --timestamp target/release/bundle/osx/Shelv.app ``` -------------------------------- ### Execute AI Prompt in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-3.md This AI code block allows users to execute a prompt and receive a response directly within a Shelv note. The prompt can be modified to include specific instructions, such as answering only as a number. ```ai What is the meaning of life? Answer ONLY as a number. ``` ```ai 42 ``` -------------------------------- ### Summarize Note Content with AI in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-3.md AI code blocks can utilize the preceding content of a Shelv note as context to perform tasks like summarization. This allows for context-aware AI interactions, treating the note as a conversational thread. ```ai Give me a concise summary of the above. ``` -------------------------------- ### JavaScript Function to Wrap Text in Quotes Source: https://github.com/twop/shelv/blob/main/src/prompts/shelv-system-prompt.md This JavaScript function `wrapInQuotes` takes a string as input and returns it enclosed within double quotes. It's designed to be used with the `InsertText` command to modify selected text. ```javascript export function wrapInQuotes(selectedText) { return `"${selectedText}"`; } ``` -------------------------------- ### Execute JavaScript Code Block in Shelv Source: https://github.com/twop/shelv/blob/main/docs/scratchpad/default-note-3.md JavaScript code blocks in Shelv automatically execute when the content changes. This allows for dynamic computation and immediate display of results within the note. The `js` identifier after the triple backticks activates this functionality. ```javascript // ^ add "js" above to make ```js const hi = (name) => "hello " + name + "!" hi("universe") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.