memd-cli 1.0.4 → 1.1.1

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/README.md CHANGED
@@ -2,15 +2,36 @@
2
2
 
3
3
  > View mermaid-ed markdown in terminal
4
4
 
5
- ## Install/Update
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  npm install -g memd-cli
9
9
  ```
10
10
 
11
-
12
11
  ## Usage
13
12
 
13
+
14
+ ```
15
+ Usage: memd [options] [files...]
16
+
17
+ Render markdown with mermaid diagrams to terminal output
18
+
19
+ Arguments:
20
+ files markdown file(s) to render
21
+
22
+ Options:
23
+ -v, --version output the version number
24
+ --no-pager disable pager (less)
25
+ --no-color disable colored output
26
+ --no-highlight disable syntax highlighting
27
+ --width <number> terminal width override
28
+ --ascii use pure ASCII mode for diagrams (default: unicode)
29
+ -h, --help display help for command
30
+ ```
31
+
32
+
33
+ ## Example
34
+
14
35
  ### File input
15
36
 
16
37
  ```
@@ -289,7 +310,7 @@ npm remove -g memd-cli
289
310
 
290
311
  ```bash
291
312
  # tag
292
- npm install -g git+https://github.com/ktrysmt/memd.git#v1.0.4
313
+ npm install -g git+https://github.com/ktrysmt/memd.git#v1.1.0
293
314
  # branch
294
315
  npm install -g git+https://github.com/ktrysmt/memd.git#master
295
316
  npm install -g git+https://github.com/ktrysmt/memd.git#feature
package/main.js CHANGED
@@ -43,6 +43,9 @@ function convertMermaidToAscii(markdown, options = {}) {
43
43
  if (options.width) {
44
44
  mermaidOptions.maxWidth = options.width;
45
45
  }
46
+ if (options.ascii) {
47
+ mermaidOptions.useAscii = true;
48
+ }
46
49
  const asciiArt = renderMermaidAscii(code.trim(), mermaidOptions);
47
50
  return '```text\n' + asciiArt + '\n```';
48
51
  } catch (error) {
@@ -126,13 +129,14 @@ function spawnPager(text, options) {
126
129
  async function main() {
127
130
  program
128
131
  .name('memd')
129
- .version(packageJson.version)
132
+ .version(packageJson.version, '-v, --version', 'output the version number')
130
133
  .description('Render markdown with mermaid diagrams to terminal output')
131
134
  .argument('[files...]', 'markdown file(s) to render')
132
135
  .option('--no-pager', 'disable pager (less)')
133
136
  .option('--no-color', 'disable colored output')
134
137
  .option('--no-highlight', 'disable syntax highlighting')
135
- .option('--width <number>', 'terminal width override', Number, process.stdout.columns ?? 80)
138
+ .option('--width <number>', 'terminal width override', Number)
139
+ .option('--ascii', 'use pure ASCII mode for diagrams (default: unicode)')
136
140
  .action(async (files, options) => {
137
141
  // Check if color should be disabled (--no-color or NO_COLOR env var)
138
142
  const useColor = options.color !== false && !process.env.NO_COLOR;
@@ -145,7 +149,7 @@ async function main() {
145
149
 
146
150
  marked.use(markedTerminal({
147
151
  reflowText: true,
148
- width: options.width,
152
+ width: options.width ?? process.stdout.columns ?? 80,
149
153
  }, highlightOptions));
150
154
 
151
155
  // Override link renderer to avoid OSC 8 escape sequences (fixes tmux display issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memd-cli",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "beautiful-mermaid": "^0.1.3",
11
11
  "cli-highlight": "^2.1.11",
12
12
  "commander": "^14.0.3",
13
- "marked": "^15.0.12",
13
+ "marked": "^17.0.3",
14
14
  "marked-terminal": "^7.3.0"
15
15
  },
16
16
  "repository": {
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "deny": [
4
- "Read(./.entire/metadata/**)"
5
- ]
6
- }
7
- }
@@ -1,12 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npx:*)",
5
- "Bash(npmwhoami)",
6
- "Bash(LINES=20 node main.js:*)",
7
- "Bash(LINES=10 node:*)",
8
- "Bash(1)",
9
- "Bash(DEBUG=1 node main.js:*)"
10
- ]
11
- }
12
- }
@@ -1,31 +0,0 @@
1
- # termaid Project Overview
2
-
3
- ## Purpose
4
- termaid is a CLI tool that renders Mermaid diagrams in markdown files to ASCII art for terminal display. It converts ```mermaid code blocks to terminal-friendly ASCII diagrams.
5
-
6
- ## Tech Stack
7
- - Runtime: Node.js (ES modules)
8
- - Markdown parser: marked + marked-terminal
9
- - Mermaid rendering: beautiful-mermaid
10
-
11
- ## Key Files
12
- - main.js - Entry point (ESM module)
13
- - package.json - Project metadata and dependencies
14
- - test/ - Test markdown files
15
-
16
- ## Project Structure
17
- ```
18
- ├── main.js # Main CLI entry point
19
- ├── package.json
20
- ├── test/
21
- │ ├── test1.md # Basic flowchart test
22
- │ ├── test2.md # Decision flowchart test
23
- │ └── test3.md # Complex diagrams (sequence, class, state)
24
- ├── README.md
25
- └── .gitignore
26
- ```
27
-
28
- ## Code Style
29
- - ES modules (`import`/`export`)
30
- - No TypeScript types (has `// @ts-nocheck`)
31
- - Simple, functional approach
@@ -1,111 +0,0 @@
1
- # Publishing to npm
2
-
3
- ## Current Status
4
- - Package name: `@ktrysmt/termaid` (Scoped package under ktrysmt org)
5
- - Version: 1.0.3 (from package.json)
6
- - Status: NOT YET published (E404 when checking registry)
7
-
8
- ## Prerequisites
9
-
10
- ### 1. npm Account
11
- - Create an account at https://www.npmjs.com/
12
- - Login with: `npm login`
13
-
14
- ### 2. Package Name Considerations
15
- - `@ktrysmt/termaid` requires write access to the `ktrysmt` scope
16
- - If you don't have access, you can:
17
- - Use a different scope: `@yourname/termaid`
18
- - Use an unscoped package: `termaid` (check availability first)
19
-
20
- ## Publish Steps
21
-
22
- ### Step 1: Verify package.json
23
- Check these fields:
24
- ```json
25
- {
26
- "name": "@ktrysmt/termaid",
27
- "version": "1.0.3",
28
- "main": "main.js",
29
- "bin": {
30
- "termaid": "main.js"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/ktrysmt/termaid.git"
35
- }
36
- }
37
- ```
38
-
39
- ### Step 2: Login to npm
40
- ```bash
41
- npm login
42
- # Follow prompts for username, password, email
43
- ```
44
-
45
- ### Step 3: Check Package Access
46
- ```bash
47
- npm access ls-collaborators @ktrysmt/termaid
48
- ```
49
-
50
- ### Step 4: Publish
51
- ```bash
52
- npm publish
53
- ```
54
-
55
- ### Step 5: Verify
56
- ```bash
57
- npm view @ktrysmt/termaid
58
- npm install -g @ktrysmt/termaid
59
- ```
60
-
61
- ## Version Management
62
-
63
- ### Bump version before publish:
64
- ```bash
65
- # Patch (bug fixes): 1.0.2 -> 1.0.3
66
- npm version patch
67
-
68
- # Minor (new features): 1.0.2 -> 1.1.0
69
- npm version minor
70
-
71
- # Major (breaking changes): 1.0.2 -> 2.0.0
72
- npm version major
73
- ```
74
-
75
- ### Or manually edit package.json, then:
76
- ```bash
77
- git add .
78
- git commit -m "chore: bump version"
79
- git tag v1.0.3 # or new version
80
- git push && git push --tags
81
- npm publish
82
- ```
83
-
84
- ## Private vs Public
85
-
86
- ### Public (default):
87
- ```bash
88
- npm publish
89
- # Accessible to everyone
90
- ```
91
-
92
- ### Private (requires paid plan):
93
- ```bash
94
- npm publish --access restricted
95
- # Only accessible to collaborators
96
- ```
97
-
98
- ### Public with scoped package (free):
99
- ```bash
100
- npm publish --access public
101
- # Works for scoped packages under free plan
102
- ```
103
-
104
- ## Common Issues
105
-
106
- | Issue | Solution |
107
- |-------|----------|
108
- | E403 Forbidden | You don't have access to this scope |
109
- | E409 Conflict | Version already exists, bump version |
110
- | ENEEDAUTH | Run `npm login` first |
111
- | EMISSINGARG | Missing name/version in package.json |
@@ -1,19 +0,0 @@
1
- # Suggested Commands for termaid
2
-
3
- ## Testing
4
- - `node main.js test/test1.md` - Test with test1.md
5
- - `node main.js test/test2.md` - Test with test2.md
6
- - `echo '# Hello\n\n```mermaid\nflowchart LR\n A --> B\n```' | node main.js` - Test with stdin
7
-
8
- ## Version Management
9
- - Check current version: `node main.js -v`
10
-
11
- ## Development
12
- - Install dependencies: `npm install`
13
- - Run with a markdown file: `node main.js <file.md>`
14
-
15
- ## Publishing (to npm)
16
- 1. Check current version in package.json
17
- 2. Update version (e.g., `npm version patch` or `npm version minor`)
18
- 3. Login: `npm login`
19
- 4. Publish: `npm publish`
@@ -1,115 +0,0 @@
1
-
2
- # whether to use the project's gitignore file to ignore files
3
- # Added on 2025-04-07
4
- ignore_all_files_in_gitignore: true
5
- # list of additional paths to ignore
6
- # same syntax as gitignore, so you can use * and **
7
- # Was previously called `ignored_dirs`, please update your config if you are using that.
8
- # Added (renamed) on 2025-04-07
9
- ignored_paths: []
10
-
11
- # whether the project is in read-only mode
12
- # If set to true, all editing tools will be disabled and attempts to use them will result in an error
13
- # Added on 2025-04-18
14
- read_only: false
15
-
16
-
17
- # list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
18
- # Below is the complete list of tools for convenience.
19
- # To make sure you have the latest list of tools, and to view their descriptions,
20
- # execute `uv run scripts/print_tool_overview.py`.
21
- #
22
- # * `activate_project`: Activates a project by name.
23
- # * `check_onboarding_performed`: Checks whether project onboarding was already performed.
24
- # * `create_text_file`: Creates/overwrites a file in the project directory.
25
- # * `delete_lines`: Deletes a range of lines within a file.
26
- # * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
27
- # * `execute_shell_command`: Executes a shell command.
28
- # * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
29
- # * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
30
- # * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
31
- # * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
32
- # * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
33
- # * `initial_instructions`: Gets the initial instructions for the current project.
34
- # Should only be used in settings where the system prompt cannot be set,
35
- # e.g. in clients you have no control over, like Claude Desktop.
36
- # * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
37
- # * `insert_at_line`: Inserts content at a given line in a file.
38
- # * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
39
- # * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
40
- # * `list_memories`: Lists memories in Serena's project-specific memory store.
41
- # * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
42
- # * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
43
- # * `read_file`: Reads a file within the project directory.
44
- # * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
45
- # * `remove_project`: Removes a project from the Serena configuration.
46
- # * `replace_lines`: Replaces a range of lines within a file with new content.
47
- # * `replace_symbol_body`: Replaces the full definition of a symbol.
48
- # * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
49
- # * `search_for_pattern`: Performs a search for a pattern in the project.
50
- # * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
51
- # * `switch_modes`: Activates modes by providing a list of their names
52
- # * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
53
- # * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
54
- # * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
55
- # * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
56
- excluded_tools: []
57
-
58
- # initial prompt for the project. It will always be given to the LLM upon activating the project
59
- # (contrary to the memories, which are loaded on demand).
60
- initial_prompt: ""
61
- # the name by which the project can be referenced within Serena
62
- project_name: "termaid"
63
-
64
- # list of mode names to that are always to be included in the set of active modes
65
- # The full set of modes to be activated is base_modes + default_modes.
66
- # If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
67
- # Otherwise, this setting overrides the global configuration.
68
- # Set this to [] to disable base modes for this project.
69
- # Set this to a list of mode names to always include the respective modes for this project.
70
- base_modes:
71
-
72
- # list of mode names that are to be activated by default.
73
- # The full set of modes to be activated is base_modes + default_modes.
74
- # If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
75
- # Otherwise, this overrides the setting from the global configuration (serena_config.yml).
76
- # This setting can, in turn, be overridden by CLI parameters (--mode).
77
- default_modes:
78
-
79
- # list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default)
80
- included_optional_tools: []
81
-
82
- # fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
83
- # This cannot be combined with non-empty excluded_tools or included_optional_tools.
84
- fixed_tools: []
85
-
86
- # the encoding used by text files in the project
87
- # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
88
- encoding: utf-8
89
-
90
-
91
- # list of languages for which language servers are started; choose from:
92
- # al bash clojure cpp csharp
93
- # csharp_omnisharp dart elixir elm erlang
94
- # fortran fsharp go groovy haskell
95
- # java julia kotlin lua markdown
96
- # matlab nix pascal perl php
97
- # php_phpactor powershell python python_jedi r
98
- # rego ruby ruby_solargraph rust scala
99
- # swift terraform toml typescript typescript_vts
100
- # vue yaml zig
101
- # (This list may be outdated. For the current list, see values of Language enum here:
102
- # https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
103
- # For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
104
- # Note:
105
- # - For C, use cpp
106
- # - For JavaScript, use typescript
107
- # - For Free Pascal/Lazarus, use pascal
108
- # Special requirements:
109
- # Some languages require additional setup/installations.
110
- # See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
111
- # When using multiple languages, the first language server that supports a given file will be used for that file.
112
- # The first language is the default language and the respective language server will be used as a fallback.
113
- # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
114
- languages:
115
- - typescript