From 0bc7cd97857022c7ebe9dbe5f83b03a86b0e8bae Mon Sep 17 00:00:00 2001 From: Tomasz Edward Posluszny Date: Sat, 14 Sep 2024 12:45:12 +0200 Subject: [PATCH 01/24] Update system.md Topic should make sense --- patterns/agility_story/system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patterns/agility_story/system.md b/patterns/agility_story/system.md index a2fb800b..4ad615f6 100644 --- a/patterns/agility_story/system.md +++ b/patterns/agility_story/system.md @@ -11,11 +11,11 @@ Please write a user story and acceptance criteria for the requested topic. Output the results in JSON format as defined in this example: { - "Topic": "Automating data quality automation", + "Topic": "Authentication and User Management", "Story": "As a user, I want to be able to create a new user account so that I can access the system.", "Criteria": "Given that I am a user, when I click the 'Create Account' button, then I should be prompted to enter my email address, password, and confirm password. When I click the 'Submit' button, then I should be redirected to the login page." } # INPUT: -INPUT: \ No newline at end of file +INPUT: From 24816f25d156f6150448ff1b3989acf63149a5b3 Mon Sep 17 00:00:00 2001 From: OddDuck11 <41813401+OddDuck11@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:31:07 -0500 Subject: [PATCH 02/24] Add pattern analyze_military_strategy Use this pattern to analyze real historic, or fictional battle strategy. --- patterns/analyze_military_strategy/system.md | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patterns/analyze_military_strategy/system.md diff --git a/patterns/analyze_military_strategy/system.md b/patterns/analyze_military_strategy/system.md new file mode 100644 index 00000000..1dc62329 --- /dev/null +++ b/patterns/analyze_military_strategy/system.md @@ -0,0 +1,29 @@ +# IDENTITY and PURPOSE +You are a military historian and strategic analyst specializing in dissecting historical battles. Your purpose is to provide comprehensive, insightful analysis of military engagements, focusing on the strategies employed by opposing forces. You excel at comparing and contrasting tactical approaches, identifying key strengths and weaknesses, and presenting this information in a clear, structured format. + +# STEPS +- Summarize the battle in 50 words or less, including the date, location, and main combatants in a section called BATTLE OVERVIEW. +- Identify and list the primary commanders for each side in a section called COMMANDERS. +- Analyze and list 10-20 key strategic decisions made by each side in a section called STRATEGIC DECISIONS. +- Extract 15-30 of the most crucial strengths and weaknesses for each opposing force into a section called STRENGTHS AND WEAKNESSES. +- Identify and list 10-20 pivotal moments or turning points in the battle in a section called PIVOTAL MOMENTS. +- Compare and contrast 15-30 tactical approaches used by both sides in a section called TACTICAL COMPARISON. +- Analyze and list 10-20 logistical factors that influenced the battle's outcome in a section called LOGISTICAL FACTORS. +- Evaluate the battle's immediate and long-term consequences in 100-150 words in a section called BATTLE CONSEQUENCES. +- Summarize the most crucial strategic lesson from this battle in a 20-word sentence in a section called KEY STRATEGIC LESSON. + +# OUTPUT INSTRUCTIONS +- Only output in Markdown format. +- Present the STRENGTHS AND WEAKNESSES and TACTICAL COMPARISON sections in a two-column format, with one side on the left and the other on the right. +- Write the STRATEGIC DECISIONS bullets as exactly 20 words each. +- Write the PIVOTAL MOMENTS bullets as exactly 15 words each. +- Write the LOGISTICAL FACTORS bullets as exactly 15 words each. +- Extract at least 15 items for each output section unless otherwise specified. +- Do not give warnings or notes; only output the requested sections. +- Use bulleted lists for output, not numbered lists. +- Do not repeat information across different sections. +- Ensure variety in how bullet points begin; avoid repetitive phrasing. +- Follow ALL these instructions meticulously when creating your output. + +# INPUT +INPUT: \ No newline at end of file From 522c1038fb10d42e8d1acc24b8d197e6b6d8fe5b Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 29 Sep 2024 16:38:40 +1000 Subject: [PATCH 03/24] Update patterns/solve_with_cot/system.md typos --- patterns/solve_with_cot/system.md | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/patterns/solve_with_cot/system.md b/patterns/solve_with_cot/system.md index 856c184b..8c3c8ce1 100644 --- a/patterns/solve_with_cot/system.md +++ b/patterns/solve_with_cot/system.md @@ -5,19 +5,28 @@ You are an AI assistant designed to provide detailed, step-by-step responses. # STEPS 1. Begin with a section. + 2. Inside the thinking section: -a. Briefly analyze the question and outline your approach. -b. Present a clear plan of steps to solve the problem. -c. Use a "Chain of Thought" reasoning process if necessary, breaking down y -3. Include a reflection> section for each idea where you: -a. Review your reasoning. -b. Check for potential errors or oversights. -c. Confirm or adjust your conclusion if necessary. -4. Be sure to close all reflection sections. -5. Close the thinking section with . -6. Provide your final answer in an ‹output> section. + +- a. Briefly analyze the question and outline your approach. + +- b. Present a clear plan of steps to solve the problem. + +- c. Use a "Chain of Thought" reasoning process if necessary, breaking down your thought process into numbered steps. + +3. Include a section for each idea where you: + +- a. Review your reasoning. + +- b. Check for potential errors or oversights. + +- c. Confirm or adjust your conclusion if necessary. + - Be sure to close all reflection sections. + - Close the thinking section with . + - Provide your final answer in an ‹output> section. + Always use these tags in your responses. Be thorough in your explanations, sho -Remember: Both and < reflection> MUST be tags and must be closed at +Remember: Both and MUST be tags and must be closed at Make sure all ‹tags> are on separate lines with no other text. # INPUT From ad6260fab53b81954398ba413b5fe587646878ce Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 29 Sep 2024 16:46:47 +1000 Subject: [PATCH 04/24] Update patterns/solve_with_cot/system.md typos part two Forgot the last typos. Sorry. --- patterns/solve_with_cot/system.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/patterns/solve_with_cot/system.md b/patterns/solve_with_cot/system.md index 8c3c8ce1..4a473d1b 100644 --- a/patterns/solve_with_cot/system.md +++ b/patterns/solve_with_cot/system.md @@ -1,6 +1,6 @@ # IDENTITY -You are an AI assistant designed to provide detailed, step-by-step responses. +You are an AI assistant designed to provide detailed, step-by-step responses. Your outputs should follow this structure: # STEPS @@ -25,8 +25,10 @@ You are an AI assistant designed to provide detailed, step-by-step responses. - Close the thinking section with . - Provide your final answer in an ‹output> section. -Always use these tags in your responses. Be thorough in your explanations, sho -Remember: Both and MUST be tags and must be closed at +Always use these tags in your responses. Be thorough in your explanations, showing each step of your reasoning process. +Aim to be precise and logical in your approach, and don't hesitate to break down complex problems into simpler components. +Your tone should be analytical and slightly formal, focusing on clear communication of your thought process. +Remember: Both and MUST be tags and must be closed at their conclusion. Make sure all ‹tags> are on separate lines with no other text. # INPUT From b2a2ea0c0348ad49166303c6cc2a0c65ae60595f Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 29 Sep 2024 17:41:14 +1000 Subject: [PATCH 05/24] Update patterns/solve_with_cot/system.md part three Noticed the opening closing brackets were incorrect < > --- patterns/solve_with_cot/system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patterns/solve_with_cot/system.md b/patterns/solve_with_cot/system.md index 4a473d1b..c7cbc8ad 100644 --- a/patterns/solve_with_cot/system.md +++ b/patterns/solve_with_cot/system.md @@ -23,13 +23,13 @@ You are an AI assistant designed to provide detailed, step-by-step responses. Yo - c. Confirm or adjust your conclusion if necessary. - Be sure to close all reflection sections. - Close the thinking section with . - - Provide your final answer in an ‹output> section. + - Provide your final answer in an section. Always use these tags in your responses. Be thorough in your explanations, showing each step of your reasoning process. Aim to be precise and logical in your approach, and don't hesitate to break down complex problems into simpler components. Your tone should be analytical and slightly formal, focusing on clear communication of your thought process. Remember: Both and MUST be tags and must be closed at their conclusion. -Make sure all ‹tags> are on separate lines with no other text. +Make sure all are on separate lines with no other text. # INPUT From cc8711cc07d55c5b863bffd42fbc1e191633be20 Mon Sep 17 00:00:00 2001 From: hallelujah-shih Date: Mon, 30 Sep 2024 11:25:10 +0800 Subject: [PATCH 06/24] support turn any web page into clean view content --- README.md | 1 + cli/cli.go | 8 +++++++ cli/flags.go | 1 + core/html_parser.go | 27 +++++++++++++++++++++++ core/html_parser_test.go | 46 ++++++++++++++++++++++++++++++++++++++++ go.mod | 5 +++++ go.sum | 18 ++++++++++++++++ 7 files changed, 106 insertions(+) create mode 100644 core/html_parser.go create mode 100644 core/html_parser_test.go diff --git a/README.md b/README.md index ee54e1fa..c95cdc5e 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ Application Options: -w, --wipecontext= Wipe context -W, --wipesession= Wipe session --dry-run Show what would be sent to the model without actually sending it + --readability Turn web page into a clean view --version Print current version Help Options: diff --git a/cli/cli.go b/cli/cli.go index a6f5c29c..da60d7be 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -189,6 +189,14 @@ func Cli(version string) (message string, err error) { } } + if currentFlags.HtmlReadability { + if msg, err := core.HtmlReadability(currentFlags.Message); err != nil { + fmt.Println("use readability parser msg err:", err) + } else { + currentFlags.Message = msg + } + } + var chatter *core.Chatter if chatter, err = fabric.GetChatter(currentFlags.Model, currentFlags.Stream, currentFlags.DryRun); err != nil { return diff --git a/cli/flags.go b/cli/flags.go index fe2f5cf4..7e47af4b 100644 --- a/cli/flags.go +++ b/cli/flags.go @@ -47,6 +47,7 @@ type Flags struct { WipeContext string `short:"w" long:"wipecontext" description:"Wipe context"` WipeSession string `short:"W" long:"wipesession" description:"Wipe session"` DryRun bool `long:"dry-run" description:"Show what would be sent to the model without actually sending it"` + HtmlReadability bool `long:"readability" description:"Turn web page into a clean view"` Version bool `long:"version" description:"Print current version"` } diff --git a/core/html_parser.go b/core/html_parser.go new file mode 100644 index 00000000..e2b87463 --- /dev/null +++ b/core/html_parser.go @@ -0,0 +1,27 @@ +package core + +import ( + "bytes" + "fmt" + "github.com/go-shiori/go-readability" +) + +// HtmlReadability Turn any web page into a clean view +// args: +// +// html (string): full data of web page +// +// return: +// +// viewContent (string): html main content +// err (error): parser error +func HtmlReadability(html string) (viewContent string, err error) { + buf := bytes.NewBufferString(html) + article, err := readability.FromReader(buf, nil) + if err != nil { + return "", err + } + fmt.Println("MAIN-CONTENT:", article.TextContent) + + return article.TextContent, nil +} diff --git a/core/html_parser_test.go b/core/html_parser_test.go new file mode 100644 index 00000000..361e5bef --- /dev/null +++ b/core/html_parser_test.go @@ -0,0 +1,46 @@ +package core + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestHtmlReadability(t *testing.T) { + tests := []struct { + name string + html string + expected string + }{ + { + name: "Empty HTML", + html: "", + expected: "", + }, + { + name: "HTML with text", + html: "

Hello World

", + expected: "Hello World", + }, + { + name: "HTML with nested tags", + html: "

Hello

World

", + expected: "HelloWorld", + }, + { + name: "HTML missing tags", + html: "

Hello

World

", + expected: "HelloWorld", + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + result, err := HtmlReadability(tc.html) + + // 验证结果 + assert.NoError(t, err) + assert.Equal(t, tc.expected, result) + }) + } +} diff --git a/go.mod b/go.mod index 4c51644d..bc4fc204 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/anaskhan96/soup v1.2.5 github.com/atotto/clipboard v0.1.4 github.com/go-git/go-git/v5 v5.12.0 + github.com/go-shiori/go-readability v0.0.0-20240923125239-59a7bd165825 github.com/google/generative-ai-go v0.18.0 github.com/jessevdk/go-flags v1.6.1 github.com/joho/godotenv v1.5.1 @@ -30,6 +31,8 @@ require ( dario.cat/mergo v1.0.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/andybalholm/cascadia v1.3.2 // indirect + github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect github.com/cloudflare/circl v1.4.0 // indirect github.com/cyphar/filepath-securejoin v0.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -39,6 +42,8 @@ require ( github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect + github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect diff --git a/go.sum b/go.sum index bdc2ed9b..375edf9b 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,12 @@ github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0k github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/anaskhan96/soup v1.2.5 h1:V/FHiusdTrPrdF4iA1YkVxsOpdNcgvqT1hG+YtcZ5hM= github.com/anaskhan96/soup v1.2.5/go.mod h1:6YnEp9A2yywlYdM4EgDz9NEHclocMepEtku7wg6Cq3s= +github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= +github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA= +github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= @@ -64,6 +68,12 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c h1:wpkoddUomPfHiOziHZixGO5ZBS73cKqVzZipfrLmO1w= +github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c/go.mod h1:oVDCh3qjJMLVUSILBRwrm+Bc6RNXGZYtoh9xdvf1ffM= +github.com/go-shiori/go-readability v0.0.0-20240923125239-59a7bd165825 h1:CpSi7xiWqGaAqVn/2MsbRoDmPwXMvvQUu3hLjX1QrOM= +github.com/go-shiori/go-readability v0.0.0-20240923125239-59a7bd165825/go.mod h1:YWa00ashoPZMAOElrSn4E1cJErhDVU6PWAll4Hxzn+w= +github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7wCLuiqMaUh5SJkkzI2gDs+FgLs= +github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -116,6 +126,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/liushuangls/go-anthropic/v2 v2.8.0 h1:0zH2jDNycbrlszxnLrG+Gx8vVT0yJAPWU4s3ZTkWzgI= github.com/liushuangls/go-anthropic/v2 v2.8.0/go.mod h1:8BKv/fkeTaL5R9R9bGkaknYBueyw2WxY20o7bImbOek= +github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/ollama/ollama v0.3.11 h1:Fs1B5WjXYUvr5bkMZZpUJfiqIAxrymujRidFABwMeV8= github.com/ollama/ollama v0.3.11/go.mod h1:YrWoNkFnPOYsnDvsf/Ztb1wxU9/IXrNsQHqcxbY2r94= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= @@ -131,12 +142,14 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/sashabaranov/go-openai v1.30.0 h1:fHv9urGxABfm885xGWsXFSk5cksa+8dJ4jGli/UQQcI= github.com/sashabaranov/go-openai v1.30.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -148,6 +161,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -196,6 +210,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -224,6 +239,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -231,6 +247,7 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -240,6 +257,7 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= From 98292df3ccc2d360d930bb9a6cf367bdf35b4848 Mon Sep 17 00:00:00 2001 From: MattBash17 <67094857+MattBash17@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:39:55 +0200 Subject: [PATCH 07/24] Update system.md in transcribe_minutes --- patterns/transcribe_minutes/system.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/patterns/transcribe_minutes/system.md b/patterns/transcribe_minutes/system.md index 9fc8f29e..6a7a5cae 100644 --- a/patterns/transcribe_minutes/system.md +++ b/patterns/transcribe_minutes/system.md @@ -16,24 +16,24 @@ Take a step back and think step-by-step about how to achieve the best possible r - In a section called MAIN IDEA, write a 15-word sentence that captures the main idea. -- In a section called MINUTES, 20 to 50 bullet points, tracking the conversation, highliting of the most surprising, insightful, and/or interesting ideas that come up. If there are less than 50 then collect all of them. Make sure you extract at least 20. +- In a section called MINUTES, write 20 to 50 bullet points, highliting of the most surprising, insightful, and/or interesting ideas that come up in the conversation. If there are less than 50 then collect all of them. Make sure you extract at least 20. -- In a section called ACTIONABLES, write bullet points for ALL agreed actionable details. This includes and case where a speaker agrees to do, or look into something. If there is a deadline mentioned, include it here. +- In a section called ACTIONABLES, write bullet points for ALL agreed actionable details. This includes cases where a speaker agrees to do or look into something. If there is a deadline mentioned, include it here. -- In a section called DECISIONS: In bullet points, include all decisions made during the meeting, including the rationale behind each decision. +- In a section called DECISIONS, include all decisions made during the meeting, including the rationale behind each decision. Present them as bullet points. -- In a section called CHALLENGES: Identify and document any challenges or issues discussed during the meeting. Note any potential solutions or strategies proposed to address these challenges +- In a section called CHALLENGES, identify and document any challenges or issues discussed during the meeting. Note any potential solutions or strategies proposed to address these challenges. -- In a section caled NEXT STEPS, Outline the next steps and action plan to be taken after the meeting +- In a section caled NEXT STEPS, outline the next steps and actions to be taken after the meeting # OUTPUT INSTRUCTIONS - Only output Markdown. -- Write MINUTE bullets as exxactly 15 words -- Write ACTIONABLES as exactly 15 words -- Write DECISIONS as exactly 15 words -- Write CHALLENFE as 2-3 sentences. -- Write NEXT STEP a 2-3 sentences +- Write MINUTES as exxactly 15 words. +- Write ACTIONABLES as exactly 15 words. +- Write DECISIONS as exactly 15 words. +- Write CHALLENGES as 2-3 sentences. +- Write NEXT STEPS a 2-3 sentences. - Do not give warnings or notes; only output the requested sections. - Do not repeat ideas, quotes, facts, or resources. - You use bulleted lists for output, not numbered lists. @@ -42,4 +42,4 @@ Take a step back and think step-by-step about how to achieve the best possible r # INPUT -INPUT: \ No newline at end of file +INPUT: From 33df4319939312de3136f30292db40c09dde412f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 1 Oct 2024 23:09:38 +0000 Subject: [PATCH 08/24] Update version to v1.4.32 and commit d6551be --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 05b4d630..7e0abde2 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-7b8ea76" +var version = "v1.4.32-d6551be" From 3c56d23b033f414a8a6ff9bc124a0ce6a04b9481 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 15:50:57 +0000 Subject: [PATCH 09/24] Update version to v1.4.32 and commit bcafea3 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 7e0abde2..77100f22 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-d6551be" +var version = "v1.4.32-bcafea3" From ed34ccfc734d1287377522fc3d8102d31b7da6d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 15:51:40 +0000 Subject: [PATCH 10/24] Update version to v1.4.32 and commit c92bcc2 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 77100f22..f21fdc42 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-bcafea3" +var version = "v1.4.32-c92bcc2" From 54825ec8d8e2ba9048434d86af488c4aa15ec70a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 15:52:15 +0000 Subject: [PATCH 11/24] Update version to v1.4.32 and commit 99e2e7d --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index f21fdc42..2779dc95 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-c92bcc2" +var version = "v1.4.32-99e2e7d" From 859ef049d26c556569d731763b2e307396d9bcad Mon Sep 17 00:00:00 2001 From: Daniel Miessler Date: Wed, 2 Oct 2024 11:43:29 -0700 Subject: [PATCH 12/24] Added extract features. --- patterns/extract_product_features/system.md | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 patterns/extract_product_features/system.md diff --git a/patterns/extract_product_features/system.md b/patterns/extract_product_features/system.md new file mode 100644 index 00000000..f221079d --- /dev/null +++ b/patterns/extract_product_features/system.md @@ -0,0 +1,31 @@ +# IDENTITY and PURPOSE + +You extract the list of product features from the input. + +Take a step back and think step-by-step about how to achieve the best possible results by following the steps below. + +# STEPS + +- Consume the whole input as a whole and think about the type of announcement or content it is. + +- Figure out which parts were talking about features of a product or service. + +- Output the list of features as a bulleted list of 15 words per bullet. + +# OUTPUT INSTRUCTIONS + +- Only output Markdown. + +- Do not give warnings or notes; only output the requested sections. + +- You use bulleted lists for output, not numbered lists. + +- Do not repeat ideas, quotes, facts, or resources. + +- Do not start items with the same opening words. + +- Ensure you follow ALL these instructions when creating your output. + +# INPUT + +INPUT: From ee1e7d399dbeb1e6defda8acd243a0556f4e2bec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 18:43:48 +0000 Subject: [PATCH 13/24] Update version to v1.4.32 and commit 859ef04 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 2779dc95..1f321c72 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-99e2e7d" +var version = "v1.4.32-859ef04" From 3990fe013b2703e20b3c6f5578a8bef17204ea3d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 20:10:21 +0000 Subject: [PATCH 14/24] Update version to v1.4.32 and commit 81b4bf3 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 1f321c72..4c52cd7a 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-859ef04" +var version = "v1.4.32-81b4bf3" From 42b5cb4413c3aa2a1945c59881307962485e7210 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:12:23 +0200 Subject: [PATCH 15/24] feat: clean up html readability; add autm. tag creation --- .github/workflows/release.yml | 4 +- ....yml => update-version-and-create-tag.yml} | 39 ++++++++++++------- .gitignore | 1 + README.md | 2 +- cli/cli.go | 17 ++++---- cli/flags.go | 2 +- converter/html_readability.go | 25 ++++++++++++ .../html_readability_test.go | 2 +- core/html_parser.go | 27 ------------- 9 files changed, 64 insertions(+), 55 deletions(-) rename .github/workflows/{update-version.yml => update-version-and-create-tag.yml} (52%) create mode 100644 converter/html_readability.go rename core/html_parser_test.go => converter/html_readability_test.go (97%) delete mode 100644 core/html_parser.go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c402e217..b71c045c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,7 @@ jobs: GOOS: ${{ env.OS }} GOARCH: ${{ matrix.arch }} run: | - go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -o fabric-${OS}-${{ matrix.arch }} . + go build -o fabric-${OS}-${{ matrix.arch }} . - name: Build binary on Windows if: matrix.os == 'windows-latest' @@ -72,7 +72,7 @@ jobs: GOOS: windows GOARCH: ${{ matrix.arch }} run: | - go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -o fabric-windows-${{ matrix.arch }}.exe . + go build -o fabric-windows-${{ matrix.arch }}.exe . - name: Upload build artifact if: matrix.os != 'windows-latest' diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version-and-create-tag.yml similarity index 52% rename from .github/workflows/update-version.yml rename to .github/workflows/update-version-and-create-tag.yml index 4873e5be..3acf2517 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version-and-create-tag.yml @@ -1,11 +1,9 @@ -name: Update Version File +name: Update Version and Create Tag on: push: branches: - - main # Or whichever branch you want to monitor - tags: - - '*' # Trigger on any new tag + - main # Monitor the main branch permissions: contents: write # Ensure the workflow has write permissions @@ -28,32 +26,43 @@ jobs: - name: Get the latest tag id: get_latest_tag run: | - latest_tag=$(git describe --tags --abbrev=0) + latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") echo "Latest tag is: $latest_tag" echo "::set-output name=tag::$latest_tag" - - name: Get the latest commit hash - id: get_commit_hash + - name: Increment minor version + id: increment_version run: | - commit_hash=$(git rev-parse --short HEAD) - echo "Commit hash is: $commit_hash" - echo "::set-output name=commit_hash::$commit_hash" + latest_tag=${{ steps.get_latest_tag.outputs.tag }} + IFS='.' read -r major minor patch <<<"${latest_tag#v}" + new_minor=$((minor + 1)) + new_tag="v${major}.${new_minor}.0" + echo "New tag is: $new_tag" + echo "::set-output name=new_tag::$new_tag" - name: Update version.go file run: | - latest_tag=${{ steps.get_latest_tag.outputs.tag }} - commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }} + new_tag=${{ steps.increment_version.outputs.new_tag }} + commit_hash=$(git rev-parse --short HEAD) echo "package main" > version.go echo "" >> version.go - echo "var version = \"${latest_tag}-${commit_hash}\"" >> version.go + echo "var version = \"${new_tag}-${commit_hash}\"" >> version.go - name: Commit changes run: | git add version.go - git commit -m "Update version to ${{ steps.get_latest_tag.outputs.tag }} and commit ${{ steps.get_commit_hash.outputs.commit_hash }}" + git commit -m "Update version to ${{ steps.increment_version.outputs.new_tag }} and commit $commit_hash" - name: Push changes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN to authenticate the push run: | - git push origin main # Or the relevant branch \ No newline at end of file + git push origin main # Push changes to the main branch + + - name: Create a new tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + new_tag=${{ steps.increment_version.outputs.new_tag }} + git tag $new_tag + git push origin $new_tag # Push the new tag diff --git a/.gitignore b/.gitignore index 0061344b..10c44e27 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ # Distribution / packaging .Python +.idea build/ develop-eggs/ dist/ diff --git a/README.md b/README.md index c95cdc5e..cf99f013 100644 --- a/README.md +++ b/README.md @@ -243,8 +243,8 @@ Application Options: -e, --seed= Seed to be used for LMM generation -w, --wipecontext= Wipe context -W, --wipesession= Wipe session + --readability Convert HTML input into a clean, readable view --dry-run Show what would be sent to the model without actually sending it - --readability Turn web page into a clean view --version Print current version Help Options: diff --git a/cli/cli.go b/cli/cli.go index f70a2d76..c31b38e0 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "github.com/danielmiessler/fabric/converter" "os" "path/filepath" "strconv" @@ -110,6 +111,14 @@ func Cli(version string) (message string, err error) { return } + if currentFlags.HtmlReadability { + if msg, cleanErr := converter.HtmlReadability(currentFlags.Message); cleanErr != nil { + fmt.Println("use original input, because can't apply html readability", err) + } else { + currentFlags.Message = msg + } + } + // if the interactive flag is set, run the interactive function // if currentFlags.Interactive { // interactive.Interactive() @@ -193,14 +202,6 @@ func Cli(version string) (message string, err error) { } } - if currentFlags.HtmlReadability { - if msg, err := core.HtmlReadability(currentFlags.Message); err != nil { - fmt.Println("use readability parser msg err:", err) - } else { - currentFlags.Message = msg - } - } - var chatter *core.Chatter if chatter, err = fabric.GetChatter(currentFlags.Model, currentFlags.Stream, currentFlags.DryRun); err != nil { return diff --git a/cli/flags.go b/cli/flags.go index 7e47af4b..29c0580e 100644 --- a/cli/flags.go +++ b/cli/flags.go @@ -46,8 +46,8 @@ type Flags struct { Seed int `short:"e" long:"seed" description:"Seed to be used for LMM generation"` WipeContext string `short:"w" long:"wipecontext" description:"Wipe context"` WipeSession string `short:"W" long:"wipesession" description:"Wipe session"` + HtmlReadability bool `long:"readability" description:"Convert HTML input into a clean, readable view"` DryRun bool `long:"dry-run" description:"Show what would be sent to the model without actually sending it"` - HtmlReadability bool `long:"readability" description:"Turn web page into a clean view"` Version bool `long:"version" description:"Print current version"` } diff --git a/converter/html_readability.go b/converter/html_readability.go new file mode 100644 index 00000000..debbe1a6 --- /dev/null +++ b/converter/html_readability.go @@ -0,0 +1,25 @@ +package converter + +import ( + "bytes" + "github.com/go-shiori/go-readability" +) + +// HtmlReadability Convert HTML input into a clean, readable view +// args: +// +// html (string): full data of web page +// +// return: +// +// viewContent (string): html main content +// err (error): parser error +func HtmlReadability(html string) (ret string, err error) { + buf := bytes.NewBufferString(html) + var article readability.Article + if article, err = readability.FromReader(buf, nil); err != nil { + return + } + ret = article.TextContent + return +} diff --git a/core/html_parser_test.go b/converter/html_readability_test.go similarity index 97% rename from core/html_parser_test.go rename to converter/html_readability_test.go index 361e5bef..a0d6bfe1 100644 --- a/core/html_parser_test.go +++ b/converter/html_readability_test.go @@ -1,4 +1,4 @@ -package core +package converter import ( "testing" diff --git a/core/html_parser.go b/core/html_parser.go deleted file mode 100644 index e2b87463..00000000 --- a/core/html_parser.go +++ /dev/null @@ -1,27 +0,0 @@ -package core - -import ( - "bytes" - "fmt" - "github.com/go-shiori/go-readability" -) - -// HtmlReadability Turn any web page into a clean view -// args: -// -// html (string): full data of web page -// -// return: -// -// viewContent (string): html main content -// err (error): parser error -func HtmlReadability(html string) (viewContent string, err error) { - buf := bytes.NewBufferString(html) - article, err := readability.FromReader(buf, nil) - if err != nil { - return "", err - } - fmt.Println("MAIN-CONTENT:", article.TextContent) - - return article.TextContent, nil -} From 857b23c3fd24df4c09470f2ef51cf098f063c9f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 22:12:41 +0000 Subject: [PATCH 16/24] Update version to v1.5.0 and commit --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 4c52cd7a..00b3b971 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32-81b4bf3" +var version = "v1.5.0-42b5cb4" From 689292f7f682c59ca6612b2d5a3f01475e4ae072 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:16:08 +0200 Subject: [PATCH 17/24] feat: clean up html readability; add autm. tag creation --- .../update-version-and-create-tag.yml | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-version-and-create-tag.yml b/.github/workflows/update-version-and-create-tag.yml index 3acf2517..2aa4e4fe 100644 --- a/.github/workflows/update-version-and-create-tag.yml +++ b/.github/workflows/update-version-and-create-tag.yml @@ -1,4 +1,4 @@ -name: Update Version and Create Tag +name: Update Version File and Create Tag on: push: @@ -28,30 +28,28 @@ jobs: run: | latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") echo "Latest tag is: $latest_tag" - echo "::set-output name=tag::$latest_tag" + echo "tag=$latest_tag" >> $GITHUB_ENV # Save the latest tag to environment file - - name: Increment minor version + - name: Increment patch version id: increment_version run: | - latest_tag=${{ steps.get_latest_tag.outputs.tag }} - IFS='.' read -r major minor patch <<<"${latest_tag#v}" - new_minor=$((minor + 1)) - new_tag="v${major}.${new_minor}.0" + IFS='.' read -r major minor patch <<<"${{ env.tag#v }}" + new_patch=$((patch + 1)) + new_tag="v${major}.${minor}.${new_patch}" echo "New tag is: $new_tag" - echo "::set-output name=new_tag::$new_tag" + echo "new_tag=$new_tag" >> $GITHUB_ENV # Save the new tag to environment file - name: Update version.go file run: | - new_tag=${{ steps.increment_version.outputs.new_tag }} commit_hash=$(git rev-parse --short HEAD) echo "package main" > version.go echo "" >> version.go - echo "var version = \"${new_tag}-${commit_hash}\"" >> version.go + echo "var version = \"${{ env.new_tag }}-${commit_hash}\"" >> version.go - name: Commit changes run: | git add version.go - git commit -m "Update version to ${{ steps.increment_version.outputs.new_tag }} and commit $commit_hash" + git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash" - name: Push changes env: @@ -63,6 +61,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - new_tag=${{ steps.increment_version.outputs.new_tag }} - git tag $new_tag - git push origin $new_tag # Push the new tag + git tag ${{ env.new_tag }} + git push origin ${{ env.new_tag }} # Push the new tag From e4d34f49379ca4451d5eb57d6d96b557c5806611 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:23:50 +0200 Subject: [PATCH 18/24] feat: clean up html readability; add autm. tag creation --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 00b3b971..2adf9fed 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.5.0-42b5cb4" +var version = "v1.4.32" From b53005a6f14fadf5553373bd9303c27e6690641e Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:26:02 +0200 Subject: [PATCH 19/24] feat: clean up html readability; add autm. tag creation --- .github/workflows/update-version-and-create-tag.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-version-and-create-tag.yml b/.github/workflows/update-version-and-create-tag.yml index 2aa4e4fe..cfb78ca1 100644 --- a/.github/workflows/update-version-and-create-tag.yml +++ b/.github/workflows/update-version-and-create-tag.yml @@ -33,7 +33,10 @@ jobs: - name: Increment patch version id: increment_version run: | - IFS='.' read -r major minor patch <<<"${{ env.tag#v }}" + latest_tag=${{ env.tag }} + major=$(echo "$latest_tag" | cut -d. -f1 | sed 's/v//') + minor=$(echo "$latest_tag" | cut -d. -f2) + patch=$(echo "$latest_tag" | cut -d. -f3) new_patch=$((patch + 1)) new_tag="v${major}.${minor}.${new_patch}" echo "New tag is: $new_tag" From 6c185c25f646d2c7210dc4940d1cc07721821a76 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 22:26:26 +0000 Subject: [PATCH 20/24] Update version to v1.4.33 and commit --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 2adf9fed..ef19b92f 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.32" +var version = "v1.4.33-b53005a" From 2d102c1a027321dd4068616b96e6fbeac0ffec38 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:42:14 +0200 Subject: [PATCH 21/24] feat: clean up html readability; add autm. tag creation --- .github/workflows/update-version-and-create-tag.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/update-version-and-create-tag.yml b/.github/workflows/update-version-and-create-tag.yml index cfb78ca1..7fa6c7e3 100644 --- a/.github/workflows/update-version-and-create-tag.yml +++ b/.github/workflows/update-version-and-create-tag.yml @@ -44,10 +44,9 @@ jobs: - name: Update version.go file run: | - commit_hash=$(git rev-parse --short HEAD) echo "package main" > version.go echo "" >> version.go - echo "var version = \"${{ env.new_tag }}-${commit_hash}\"" >> version.go + echo "var version = \"${{ env.new_tag }}\"" >> version.go - name: Commit changes run: | From d6d721737bc058a43e7e688f0a7166f4604d6a17 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 22:42:32 +0000 Subject: [PATCH 22/24] Update version to v1.4.34 and commit --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index ef19b92f..ec7e6d43 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.33-b53005a" +var version = "v1.4.34" From 7e9d7f6f3221eb855c9aab8647516b58bdcb5fbc Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 3 Oct 2024 00:44:10 +0200 Subject: [PATCH 23/24] feat: clean up html readability; add autm. tag creation --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b71c045c..6dd7ea6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: Go Release on: push: - branches: ["main"] tags: - "v*" From 0ccf34ea8c8a2762c61b31254cffb4e0dfdee359 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Oct 2024 22:45:01 +0000 Subject: [PATCH 24/24] Update version to v1.4.35 and commit --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index ec7e6d43..57c94f59 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -var version = "v1.4.34" +var version = "v1.4.35"