Specification
While testing hole punching with the testnet, we found a few issues with the CLI.
- Nodes Get All is throwing an error
- We are getting a weird output format for nodes connections what is the 0 and what is this NA for?
- I think nodes connections is better suited for dictionary format - list format or table format (can you check which ones done robustly)
- The output changes sometimes, to just join the NA after the ip address, so no port is available
- Summary - the nodes connections command is just very non-deterministic
- Secret leak is occurring on agent service, there should be no authorisation metadata see --format=json
- What's usageCount
Automatic Encoding
For these two formats, encoding is applied by default so that special characters will not mess up the padding for any given output.
- dict format
- will automatically encase any string in a
\"\" and apply encoding to the input
- table format
- will automatically encase any string in a
\"\" and apply encoding to the input
Manual Encoding with Utility Functions
For any other format passed into outputFormatter, there will be no encoding of escapable characters by default.
It is up to the user to use the following functions in src/utils/utils.ts to encode parts of their input:
/**
* This function:
*
* 1. Keeps regular spaces, only ' ', as they are.
* 2. Converts \\n \\r \\t to escaped versions, \\\\n \\\\r and \\\\t.
* 3. Converts other control characters to their Unicode escape sequences.\
* 4. Converts ' \` " to escaped versions, \\\\' \\\\\` and \\\\"
*
* Unless you're using this in a `JSON.stringify` replacer, you probably want to use {@link encodeEscapedWrapped} instead.
*/
function encodeEscaped(str: string): string
/**
* This function:
* 1. Keeps regular spaces, only ' ', as they are.
* 2. Converts \\n \\r \\t to escaped versions, \\\\n \\\\r and \\\\t.
* 3. Converts other control characters to their Unicode escape sequences.
* 4. Converts ' \` " to escaped versions, \\\\' \\\\\` and \\\\"
* 5. Wraps the whole thing in `""` if any characters have been encoded.
*/
function encodeEscapedWrapped(str: string): string
To use this:
const v = `test ${encodeEscapedWrapped("\u0000\"\n")}` // returns '"\\u0000\\"\\n"'
Note that any encoded strings must be encased in "" anyways. This is so that when the user copy-pastes the output as the input of another command, or pipes the output to another command, those escaped characters will be collapsed correctly.
Additional context
Tasks
Specification
While testing hole punching with the testnet, we found a few issues with the CLI.
Automatic Encoding
For these two formats, encoding is applied by default so that special characters will not mess up the padding for any given output.
\"\"and apply encoding to the input\"\"and apply encoding to the inputManual Encoding with Utility Functions
For any other format passed into
outputFormatter, there will be no encoding of escapable characters by default.It is up to the user to use the following functions in
src/utils/utils.tsto encode parts of their input:To use this:
Note that any encoded strings must be encased in
""anyways. This is so that when the user copy-pastes the output as the input of another command, or pipes the output to another command, those escaped characters will be collapsed correctly.Additional context
Tasks
nodes getallcommand, it's throwing an error relating tohostnot being defined.nodes connectionscommand output formatting. The output is very unclear.nodes connections --format jsonoutput. This should not be the case.agent statuscommand outputs too much information. We should strip out the key and certificate information.