-
Notifications
You must be signed in to change notification settings - Fork 1
Add improve-loop skill for systematic shell feature review #75
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9caef3d
Add improve-loop skill for systematic shell feature review
AlexandreYang ff209bc
Increase improve-loop max iterations to 50
AlexandreYang 5a440d9
Add PR comment steps, randomize target order in improve-loop skill
AlexandreYang 31d83b9
Show current target name in Step 2 task subject during improve-loop
AlexandreYang f342458
[field_splitting] Add test documenting consecutive non-whitespace IFS…
AlexandreYang 30e1626
batch 50
AlexandreYang 5b8dcb0
[inline_var] Use defer for variable restoration to protect against pa…
AlexandreYang af45be3
[improve] batch 6: fix printf %q length modifier bug, add grep --help
AlexandreYang 0e74fc5
[ls] Add --help flag (long-only since -h is --human-readable)
AlexandreYang c7e3023
update .claude/skills/improve-loop/SKILL.md
AlexandreYang 0a42927
[improve] batch 1: fix readonly guards, parse error exit code, expand…
AlexandreYang 813f09d
[improve] batch 2: add test coverage for line_continuation and cmd_se…
AlexandreYang 3178ed8
[exit] Fix bash compat: exit with invalid arg should not terminate shell
AlexandreYang 25fb4cf
[improve] batch 5: fix field_splitting dead test, printf --help, pipe…
AlexandreYang 46d2942
[loopctl] Fix bash compat: break/continue with too many args should e…
AlexandreYang 7bd6261
[improve] batch 10: fix empty script CLI, loopctl exit code bash compat
AlexandreYang f4413ac
[exit] Fix misleading doc comment about invalid arg behavior
AlexandreYang 054cb23
[strings] Add missing --help scenario test
AlexandreYang dea2d23
[iter 1] Address PR review comments: add expandErr test and fix stder…
AlexandreYang 294b980
[iter 2] Fix exit non-numeric arg, printf --help exit code, redundant…
AlexandreYang 870c945
[iter 3] Fix exit error test descriptions and remove skip_assert_agai…
AlexandreYang 6000237
[iter 4] Fix break/continue non-numeric arg exit code: 128 → 2 (bash …
AlexandreYang 65a76d2
[iter 4] Fix break/continue invalid arg exit code to match bash (128,…
AlexandreYang 35a9be4
[iter 5] Fix pipe reader deadlock: close pr before wg.Wait()
AlexandreYang 5a2d60d
[iter 6] Fix if_then_semicolons test description: if/then/fi not if/t…
AlexandreYang 849519d
[iter 8] [ls] Gate backslash path separator handling to Windows only
AlexandreYang 0ddb9ae
Merge main into alex/improve_loop
AlexandreYang 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,90 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed | ||
| // under the Apache License Version 2.0. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2026-present Datadog, Inc. | ||
|
|
||
| package interp | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "context" | ||
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "mvdan.cc/sh/v3/expand" | ||
| "mvdan.cc/sh/v3/syntax" | ||
| ) | ||
|
|
||
| func TestReadonlyVariableBlocksReassignment(t *testing.T) { | ||
| var stdout, stderr bytes.Buffer | ||
| r, err := New( | ||
| StdIO(nil, &stdout, &stderr), | ||
| Env("RO_VAR=original"), | ||
| ) | ||
| require.NoError(t, err) | ||
| t.Cleanup(func() { r.Close() }) | ||
|
|
||
| // Mark RO_VAR as readonly via the environment overlay. | ||
| r.Reset() | ||
| r.writeEnv.Set("RO_VAR", expand.Variable{ | ||
| Set: true, | ||
| Kind: expand.String, | ||
| Str: "original", | ||
| ReadOnly: true, | ||
| }) | ||
|
|
||
| parser := syntax.NewParser() | ||
| prog, err := parser.Parse(strings.NewReader("RO_VAR=changed\necho $RO_VAR"), "") | ||
| require.NoError(t, err) | ||
|
|
||
| r.fillExpandConfig(context.Background()) | ||
| r.stmts(context.Background(), prog.Stmts) | ||
|
|
||
| assert.Contains(t, stderr.String(), "readonly variable", | ||
| "reassigning a readonly variable should produce an error on stderr") | ||
| assert.Contains(t, stdout.String(), "original", | ||
| "readonly variable value should remain unchanged") | ||
| } | ||
|
|
||
| func TestReadonlyVariableBlocksUnset(t *testing.T) { | ||
| r := newResetRunner(t) | ||
|
|
||
| // Set a readonly variable. | ||
| r.writeEnv.Set("RO_VAR", expand.Variable{ | ||
| Set: true, | ||
| Kind: expand.String, | ||
| Str: "protected", | ||
| ReadOnly: true, | ||
| }) | ||
|
|
||
| // Attempt to unset it by passing an unset Variable. | ||
| err := r.writeEnv.Set("RO_VAR", expand.Variable{}) | ||
| assert.Error(t, err, "unsetting a readonly variable should return an error") | ||
| assert.Contains(t, err.Error(), "readonly variable") | ||
|
|
||
| // Verify the variable is still set. | ||
| vr := r.writeEnv.Get("RO_VAR") | ||
| assert.Equal(t, "protected", vr.Str, "readonly variable should still hold its value") | ||
| } | ||
|
|
||
| func TestReadonlyVariableBlocksKeepValueAttributeChange(t *testing.T) { | ||
| r := newResetRunner(t) | ||
|
|
||
| // Set a readonly variable. | ||
| r.writeEnv.Set("RO_VAR", expand.Variable{ | ||
| Set: true, | ||
| Kind: expand.String, | ||
| Str: "locked", | ||
| ReadOnly: true, | ||
| }) | ||
|
|
||
| // Attempt to change attributes via KeepValue. | ||
| err := r.writeEnv.Set("RO_VAR", expand.Variable{ | ||
| Kind: expand.KeepValue, | ||
| Exported: true, | ||
| }) | ||
| assert.Error(t, err, "modifying attributes on a readonly variable via KeepValue should fail") | ||
| assert.Contains(t, err.Error(), "readonly variable") | ||
| } |
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
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
Oops, something went wrong.
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.