-
Notifications
You must be signed in to change notification settings - Fork 0
Add VS Code extension for dev-process-manager #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
18
commits into
main
Choose a base branch
from
copilot/implement-vscode-plugin-socket
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
93459ab
Add VS Code extension for dev-process-manager
Copilot df1b998
Fix variable declaration order in isDaemonRunning
Copilot 8751fd7
polish implementation
nsams 9ca45dc
Refactor daemon to send JSON status and add version checking
nsams c88d3dc
add license
nsams 5e7eecb
changeset
nsams 1bb9037
eslint --fix
nsams 8cf4255
shared types between dev-pm packge and vscode extension
nsams a146f45
don't show logPrefix in vscode logs (not just add a comment pretendin…
nsams 8f8eaa9
update icon
nsams 5935050
Merge branch 'main' into copilot/implement-vscode-plugin-socket
VPS-Fabi c05c3b7
Merge remote-tracking branch 'origin/main' into copilot/implement-vsc…
Copilot 7a9c822
Move shared-types.d.ts into src/ to preserve output structure
Copilot aed1652
Merge branch 'main' into copilot/implement-vscode-plugin-socket
nsams 7853a7d
Add extension icon
nsams 9799ebe
remove changeset, this is already in main
nsams fdba306
Remove comet from
nsams 7bca6b0
Merge branch 'main' into copilot/implement-vscode-plugin-socket
nsams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@comet/dev-process-manager": minor | ||
| --- | ||
|
|
||
| Refactor status output (as json) in preparation for vscode extension | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| node_modules | ||
| /lib | ||
| /vscode-extension/out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import { type LogsCommandOptions } from "../daemon-command/logs.daemon-command.js"; | ||
| import { connect } from "./connect.js"; | ||
| import { connect, pipeToStdout } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| export const logs = async (options: LogsCommandOptions): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
| pipeToStdout(client); | ||
| client.write(`logs ${JSON.stringify(options)}`); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import { type RestartCommandOptions } from "../daemon-command/restart.daemon-command.js"; | ||
| import { connect } from "./connect.js"; | ||
| import { connect, pipeToStdout } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| export const restart = async (options: RestartCommandOptions): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
| pipeToStdout(client); | ||
| client.write(`restart ${JSON.stringify(options)}`); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { connect } from "./connect.js"; | ||
| import { connect, pipeToStdout } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| export const shutdown = async (): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
| pipeToStdout(client); | ||
| client.write("shutdown"); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import { type StartCommandOptions } from "../daemon-command/start.daemon-command.js"; | ||
| import { connect } from "./connect.js"; | ||
| import { connect, pipeToStdout } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| export const start = async (options: StartCommandOptions): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
| pipeToStdout(client); | ||
| client.write(`start ${JSON.stringify(options)}`); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,67 @@ | ||
| import { type StatusCommandOptions } from "../daemon-command/status.daemon-command.js"; | ||
| import CLITable from "cli-table3"; | ||
| import colors from "colors"; | ||
| import { create as createLogUpdate } from "log-update"; | ||
|
|
||
| import { type ScriptStatus } from "../daemon-command/script.js"; | ||
| import { type ScriptStatusEntry, type StatusCommandOptions } from "../daemon-command/status.daemon-command.js"; | ||
| import { connect } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| const statusTexts: { [status in ScriptStatus]: string } = { | ||
| started: colors.green("Running"), | ||
| stopping: colors.red("Stopping"), | ||
| stopped: "Stopped", | ||
| waiting: colors.yellow("Waiting"), | ||
| backoff: colors.red("Backoff"), | ||
| }; | ||
|
|
||
| function renderTable(entries: ScriptStatusEntry[]): string { | ||
| const table = new CLITable({ | ||
| head: [ | ||
| colors.blue.bold("ID"), | ||
| colors.blue.bold("Script"), | ||
| colors.blue.bold("Status"), | ||
| colors.blue.bold("CPU"), | ||
| colors.blue.bold("Mem"), | ||
| colors.bold.blue("PID"), | ||
| colors.bold.blue("Restarts"), | ||
| ], | ||
| style: { compact: true }, | ||
| }); | ||
| for (const entry of entries) { | ||
| table.push([entry.id, entry.name, statusTexts[entry.status], entry.cpu, entry.memory, entry.pid?.toString(), entry.restarts]); | ||
| } | ||
| return table.toString(); | ||
| } | ||
|
|
||
| export const status = async (options: StatusCommandOptions): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
|
|
||
| const logUpdate = options.interval ? createLogUpdate(process.stdout) : undefined; | ||
| let buffer = ""; | ||
|
|
||
| client.on("data", (data: Buffer) => { | ||
| buffer += data.toString(); | ||
| let newlineIndex: number; | ||
| while ((newlineIndex = buffer.indexOf("\n")) !== -1) { | ||
| const line = buffer.substring(0, newlineIndex); | ||
| buffer = buffer.substring(newlineIndex + 1); | ||
|
|
||
| const parsed = JSON.parse(line); | ||
| if (parsed.error) { | ||
| console.log(parsed.error); | ||
| return; | ||
| } | ||
|
|
||
| const output = renderTable(parsed as ScriptStatusEntry[]); | ||
| if (logUpdate) { | ||
| logUpdate(output); | ||
| } else { | ||
| console.log(output); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| client.write(`status ${JSON.stringify(options)}`); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import { type StopCommandOptions } from "../daemon-command/stop.daemon-command.js"; | ||
| import { connect } from "./connect.js"; | ||
| import { connect, pipeToStdout } from "./connect.js"; | ||
| import { validConfigOrExit } from "./validate-config.js"; | ||
|
|
||
| export const stop = async (options: StopCommandOptions): Promise<void> => { | ||
| await validConfigOrExit(); | ||
| const client = await connect(); | ||
| pipeToStdout(client); | ||
| client.write(`stop ${JSON.stringify(options)}`); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .vscode/** | ||
| .vscode-test/** | ||
| src/** | ||
| node_modules/** | ||
| tsconfig.json | ||
| **/*.map | ||
| **/*.ts | ||
| !out/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| BSD 2-Clause License | ||
|
|
||
| Copyright (c) 2019, Vivid Planet Software GmbH | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, this | ||
| list of conditions and the following disclaimer. | ||
|
|
||
| * Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.