From 3ba24d448e2f76e77b5c3b73b5ad933d1a3cfadb Mon Sep 17 00:00:00 2001 From: Ruben Restrepo Date: Thu, 19 Oct 2023 12:30:09 -0500 Subject: [PATCH] Change to skipPrompts and fix yaml parser --- .../{skipenv => skipPrompts}/DISABLED.md | 2 +- .../{skipenv => skipPrompts}/ENABLED.md | 2 +- .../{skipenv => skipPrompts}/NONE.md | 0 internal/api/runme/parser/v1/parser.proto | 2 +- internal/document/frontmatter.go | 12 +-- .../gen/proto/go/runme/parser/v1/parser.pb.go | 90 +++++++++---------- .../proto/ts/runme/parser/v1/parser_pb.d.ts | 4 +- .../gen/proto/ts/runme/parser/v1/parser_pb.js | 2 +- .../gen/proto/ts/runme/parser/v1/parser_pb.ts | 6 +- pkg/project/project_test.go | 23 +++++ 10 files changed, 83 insertions(+), 60 deletions(-) rename examples/frontmatter/{skipenv => skipPrompts}/DISABLED.md (73%) rename examples/frontmatter/{skipenv => skipPrompts}/ENABLED.md (74%) rename examples/frontmatter/{skipenv => skipPrompts}/NONE.md (100%) diff --git a/examples/frontmatter/skipenv/DISABLED.md b/examples/frontmatter/skipPrompts/DISABLED.md similarity index 73% rename from examples/frontmatter/skipenv/DISABLED.md rename to examples/frontmatter/skipPrompts/DISABLED.md index 33dc8047b..50482f06d 100644 --- a/examples/frontmatter/skipenv/DISABLED.md +++ b/examples/frontmatter/skipPrompts/DISABLED.md @@ -1,5 +1,5 @@ --- -skipenv: false +skipPrompts: false --- ```sh diff --git a/examples/frontmatter/skipenv/ENABLED.md b/examples/frontmatter/skipPrompts/ENABLED.md similarity index 74% rename from examples/frontmatter/skipenv/ENABLED.md rename to examples/frontmatter/skipPrompts/ENABLED.md index fbd77fd9a..f539e86d9 100644 --- a/examples/frontmatter/skipenv/ENABLED.md +++ b/examples/frontmatter/skipPrompts/ENABLED.md @@ -1,5 +1,5 @@ --- -skipenv: true +skipPrompts: true --- ```sh diff --git a/examples/frontmatter/skipenv/NONE.md b/examples/frontmatter/skipPrompts/NONE.md similarity index 100% rename from examples/frontmatter/skipenv/NONE.md rename to examples/frontmatter/skipPrompts/NONE.md diff --git a/internal/api/runme/parser/v1/parser.proto b/internal/api/runme/parser/v1/parser.proto index ab9010625..8ca8e4898 100644 --- a/internal/api/runme/parser/v1/parser.proto +++ b/internal/api/runme/parser/v1/parser.proto @@ -32,7 +32,7 @@ message Cell { message Frontmatter { string shell = 1; string cwd = 2; - bool skip_env = 3; + bool skip_prompts = 3; } message DeserializeRequest { diff --git a/internal/document/frontmatter.go b/internal/document/frontmatter.go index e9f45f574..5a7898def 100644 --- a/internal/document/frontmatter.go +++ b/internal/document/frontmatter.go @@ -11,9 +11,9 @@ import ( ) type Frontmatter struct { - Shell string - Cwd string - SkipEnv bool + Shell string + Cwd string + SkipPrompts bool `yaml:"skipPrompts,omitempty"` } type FrontmatterParseInfo struct { @@ -69,8 +69,8 @@ func ParseFrontmatter(raw string) (f Frontmatter, info FrontmatterParseInfo) { func (fmtr Frontmatter) ToParser() *parserv1.Frontmatter { return &parserv1.Frontmatter{ - Shell: fmtr.Shell, - Cwd: fmtr.Cwd, - SkipEnv: fmtr.SkipEnv, + Shell: fmtr.Shell, + Cwd: fmtr.Cwd, + SkipPrompts: fmtr.SkipPrompts, } } diff --git a/internal/gen/proto/go/runme/parser/v1/parser.pb.go b/internal/gen/proto/go/runme/parser/v1/parser.pb.go index 760e38755..55fa098e3 100644 --- a/internal/gen/proto/go/runme/parser/v1/parser.pb.go +++ b/internal/gen/proto/go/runme/parser/v1/parser.pb.go @@ -271,9 +271,9 @@ type Frontmatter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Shell string `protobuf:"bytes,1,opt,name=shell,proto3" json:"shell,omitempty"` - Cwd string `protobuf:"bytes,2,opt,name=cwd,proto3" json:"cwd,omitempty"` - SkipEnv bool `protobuf:"varint,3,opt,name=skip_env,json=skipEnv,proto3" json:"skip_env,omitempty"` + Shell string `protobuf:"bytes,1,opt,name=shell,proto3" json:"shell,omitempty"` + Cwd string `protobuf:"bytes,2,opt,name=cwd,proto3" json:"cwd,omitempty"` + SkipPrompts bool `protobuf:"varint,3,opt,name=skip_prompts,json=skipPrompts,proto3" json:"skip_prompts,omitempty"` } func (x *Frontmatter) Reset() { @@ -322,9 +322,9 @@ func (x *Frontmatter) GetCwd() string { return "" } -func (x *Frontmatter) GetSkipEnv() bool { +func (x *Frontmatter) GetSkipPrompts() bool { if x != nil { - return x.SkipEnv + return x.SkipPrompts } return false } @@ -560,50 +560,50 @@ var file_runme_parser_v1_parser_proto_rawDesc = []byte{ 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x50, 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6e, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x58, 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x77, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x77, 0x64, 0x12, - 0x19, 0x0a, 0x08, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x70, 0x45, 0x6e, 0x76, 0x22, 0x2c, 0x0a, 0x12, 0x44, 0x65, - 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x13, 0x44, 0x65, 0x73, 0x65, - 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x35, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x08, 0x6e, 0x6f, - 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x49, 0x0a, 0x10, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, - 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x6e, 0x6f, - 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x72, - 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4e, - 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, - 0x6b, 0x22, 0x2b, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2a, 0x4f, - 0x0a, 0x08, 0x43, 0x65, 0x6c, 0x6c, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x45, - 0x4c, 0x4c, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, 0x49, - 0x4e, 0x44, 0x5f, 0x4d, 0x41, 0x52, 0x4b, 0x55, 0x50, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x43, - 0x45, 0x4c, 0x4c, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x02, 0x32, - 0xc1, 0x01, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x12, 0x23, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, - 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, - 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, - 0x09, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x2e, 0x72, 0x75, 0x6e, - 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, - 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, + 0x21, 0x0a, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x6b, 0x69, 0x70, 0x50, 0x72, 0x6f, 0x6d, 0x70, + 0x74, 0x73, 0x22, 0x2c, 0x0a, 0x12, 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x13, 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, + 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x72, 0x75, 0x6e, 0x6d, + 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x74, 0x65, + 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x49, + 0x0a, 0x10, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, + 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x52, + 0x08, 0x6e, 0x6f, 0x74, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x22, 0x2b, 0x0a, 0x11, 0x53, 0x65, 0x72, + 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2a, 0x4f, 0x0a, 0x08, 0x43, 0x65, 0x6c, 0x6c, 0x4b, 0x69, + 0x6e, 0x64, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, + 0x10, 0x43, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x4d, 0x41, 0x52, 0x4b, 0x55, + 0x50, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, 0x49, 0x4e, 0x44, + 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x02, 0x32, 0xc1, 0x01, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x0b, 0x44, 0x65, 0x73, + 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x23, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, + 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x73, 0x65, 0x72, + 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x70, 0x61, 0x72, - 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x76, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x65, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x09, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, + 0x7a, 0x65, 0x12, 0x21, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2e, 0x70, 0x61, + 0x72, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x4a, 0x5a, 0x48, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, + 0x75, 0x6c, 0x2f, 0x72, 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, + 0x75, 0x6e, 0x6d, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x70, + 0x61, 0x72, 0x73, 0x65, 0x72, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/proto/ts/runme/parser/v1/parser_pb.d.ts b/internal/gen/proto/ts/runme/parser/v1/parser_pb.d.ts index 885541633..7d9a83149 100644 --- a/internal/gen/proto/ts/runme/parser/v1/parser_pb.d.ts +++ b/internal/gen/proto/ts/runme/parser/v1/parser_pb.d.ts @@ -76,9 +76,9 @@ export interface Frontmatter { */ cwd: string; /** - * @generated from protobuf field: bool skip_env = 3; + * @generated from protobuf field: bool skip_prompts = 3; */ - skipEnv: boolean; + skipPrompts: boolean; } /** * @generated from protobuf message runme.parser.v1.DeserializeRequest diff --git a/internal/gen/proto/ts/runme/parser/v1/parser_pb.js b/internal/gen/proto/ts/runme/parser/v1/parser_pb.js index 5db10060a..7fb4e9545 100644 --- a/internal/gen/proto/ts/runme/parser/v1/parser_pb.js +++ b/internal/gen/proto/ts/runme/parser/v1/parser_pb.js @@ -77,7 +77,7 @@ class Frontmatter$Type extends MessageType { super("runme.parser.v1.Frontmatter", [ { no: 1, name: "shell", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "cwd", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "skip_env", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + { no: 3, name: "skip_prompts", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } ]); } } diff --git a/internal/gen/proto/ts/runme/parser/v1/parser_pb.ts b/internal/gen/proto/ts/runme/parser/v1/parser_pb.ts index c6c3f2b4e..88d7594b6 100644 --- a/internal/gen/proto/ts/runme/parser/v1/parser_pb.ts +++ b/internal/gen/proto/ts/runme/parser/v1/parser_pb.ts @@ -200,9 +200,9 @@ export class Frontmatter extends Message { cwd = ""; /** - * @generated from field: bool skip_env = 3; + * @generated from field: bool skip_prompts = 3; */ - skipEnv = false; + skipPrompts = false; constructor(data?: PartialMessage) { super(); @@ -214,7 +214,7 @@ export class Frontmatter extends Message { static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "shell", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 2, name: "cwd", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 3, name: "skip_env", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 3, name: "skip_prompts", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): Frontmatter { diff --git a/pkg/project/project_test.go b/pkg/project/project_test.go index 51dbdf217..a0e88da63 100644 --- a/pkg/project/project_test.go +++ b/pkg/project/project_test.go @@ -296,6 +296,29 @@ func Test_codeBlockFrontmatter(t *testing.T) { assert.Equal(t, taskMemo["ZSH.md"].GetFrontmatter().Shell, "zsh") } +func Test_codeBlockSkipPromptsFrontmatter(t *testing.T) { + cwd, err := os.Getwd() + require.NoError(t, err) + + proj, err := NewDirectoryProject(filepath.Join(cwd, "../../", "examples", "frontmatter", "skipPrompts"), false, true, true, []string{}) + require.NoError(t, err) + + tasks, err := LoadProjectTasks(proj) + require.NoError(t, err) + + t.Log(tasks) + + taskMemo := make(map[string]FileCodeBlock) + + for _, task := range tasks { + taskMemo[filepath.Base(task.GetFile())] = task + } + + assert.Equal(t, taskMemo["DISABLED.md"].GetFrontmatter().SkipPrompts, false) + assert.Equal(t, taskMemo["ENABLED.md"].GetFrontmatter().SkipPrompts, true) + assert.Equal(t, taskMemo["NONE.md"].GetFrontmatter().SkipPrompts, false) +} + func projectDir() billy.Filesystem { _, b, _, _ := runtime.Caller(0) root := filepath.Join(