Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[remote.github]
owner = "MostroP2P"
repo = "mostro-cli"
token = "${GITHUB_TOKEN}"

[changelog]
# A Tera template to be rendered for each release in the changelog.
Expand All @@ -29,6 +28,10 @@ That will verify the signature of the manifest file, which ensures integrity and
## What's Changed

{%- if version %} in {{ version }}{%- endif -%}
{% for group, commits in commits | group_by(attribute="group") %}
{% if group != "" %}
### {{ group }}
{% endif %}
{% for commit in commits %}
{% if commit.remote.pr_title -%}
{%- set commit_message = commit.remote.pr_title -%}
Expand All @@ -40,15 +43,16 @@ That will verify the signature of the manifest file, which ensures integrity and
{% if commit.remote.pr_number %} in \
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
{%- endif %}
{%- endfor %}
{%- endfor -%}

{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
{% if github.contributors | length != 0 %}
{% raw %}\n{% endraw -%}
## New Contributors
## Contributors
{%- endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{% for contributor in github.contributors %}
* @{{ contributor.username }} made their contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
Expand Down Expand Up @@ -76,7 +80,27 @@ footer = """
"""
# An array of regex based postprocessors to modify the changelog.
# Replace the placeholder `<REPO>` with a URL.
postprocessors = []
postprocessors = [{ pattern = "<!-- \\d+ -->", replace = "" }]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat(\\(.+\\))?!?:", group = "🚀 Features" },
{ message = "^fix(\\(.+\\))?!?:", group = "🐛 Bug Fixes" },
{ message = "^docs(\\(.+\\))?!?:", group = "📚 Documentation" },
{ message = "^perf(\\(.+\\))?!?:", group = "⚡ Performance" },
{ message = "^refactor(\\(.+\\))?!?:", group = "🚜 Refactor" },
{ message = "^style(\\(.+\\))?!?:", group = "🎨 Styling" },
{ message = "^test(\\(.+\\))?!?:", group = "🧪 Testing" },
{ message = "^ci(\\(.+\\))?!?:", group = "⚙️ CI/CD" },
{ message = "^build(\\(.+\\))?!?:", group = "🔨 Build" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore(\\(.+\\))?!?:", group = "⚙️ Miscellaneous Tasks" },
{ body = "(?i)security", group = "🛡️ Security" },
{ message = "^revert", group = "◀️ Revert" },
{ message = ".*", group = "💼 Other" },
]

[git]
# Parse commits according to the conventional commits specification.
Expand Down
49 changes: 5 additions & 44 deletions src/cli/take_dispute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use mostro_core::prelude::*;
use uuid::Uuid;

use crate::{cli::Context, util::send_dm};
use crate::{cli::Context, util::admin_send_dm};

pub async fn execute_admin_add_solver(npubkey: &str, ctx: &Context) -> Result<()> {
println!(
Expand All @@ -20,16 +20,7 @@ pub async fn execute_admin_add_solver(npubkey: &str, ctx: &Context) -> Result<()
.as_json()
.map_err(|_| anyhow::anyhow!("Failed to serialize message"))?;

send_dm(
&ctx.client,
Some(&ctx.identity_keys),
&ctx.trade_keys,
&ctx.mostro_pubkey,
take_dispute_message,
None,
false,
)
.await?;
admin_send_dm(ctx, take_dispute_message).await?;

Ok(())
}
Expand All @@ -48,16 +39,7 @@ pub async fn execute_admin_cancel_dispute(dispute_id: &Uuid, ctx: &Context) -> R

println!("Admin keys: {:?}", ctx.context_keys.public_key.to_string());

send_dm(
&ctx.client,
Some(&ctx.context_keys),
&ctx.trade_keys,
&ctx.mostro_pubkey,
take_dispute_message,
None,
false,
)
.await?;
admin_send_dm(ctx, take_dispute_message).await?;

Ok(())
}
Expand All @@ -75,18 +57,7 @@ pub async fn execute_admin_settle_dispute(dispute_id: &Uuid, ctx: &Context) -> R
.map_err(|_| anyhow::anyhow!("Failed to serialize message"))?;

println!("Admin keys: {:?}", ctx.context_keys.public_key.to_string());

send_dm(
&ctx.client,
Some(&ctx.context_keys),
&ctx.trade_keys,
&ctx.mostro_pubkey,
take_dispute_message,
None,
false,
)
.await?;

admin_send_dm(ctx, take_dispute_message).await?;
Ok(())
}

Expand All @@ -109,16 +80,6 @@ pub async fn execute_take_dispute(dispute_id: &Uuid, ctx: &Context) -> Result<()

println!("Admin keys: {:?}", ctx.context_keys.public_key.to_string());

send_dm(
&ctx.client,
Some(&ctx.context_keys),
&ctx.trade_keys,
&ctx.mostro_pubkey,
take_dispute_message,
None,
false,
)
.await?;

admin_send_dm(ctx, take_dispute_message).await?;
Ok(())
}
15 changes: 15 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,5 +662,20 @@ pub async fn run_simple_order_msg(command: Commands, order_id: &Uuid, ctx: &Cont
execute_send_msg(command, Some(*order_id), ctx, None).await
}

// helper (place near other CLI utils)
pub async fn admin_send_dm(ctx: &Context, msg: String) -> anyhow::Result<()> {
send_dm(
&ctx.client,
Some(&ctx.context_keys),
&ctx.trade_keys,
&ctx.mostro_pubkey,
msg,
None,
false,
)
.await?;
Ok(())
}

#[cfg(test)]
mod tests {}