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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
with:
fetch-depth: 0

- uses: Conalh/TaskBound@v0.2.0
- uses: Conalh/TaskBound@v0.2.1
with:
fail-on: none
```
Expand All @@ -127,7 +127,7 @@ The action uploads nothing by default. It reads local git state from the checked
You can still override the task explicitly:

```yaml
- uses: Conalh/TaskBound@v0.2.0
- uses: Conalh/TaskBound@v0.2.1
with:
task: Fix header CSS styling
fail-on: none
Expand All @@ -138,7 +138,7 @@ API key to the job. If the key is absent or the model call fails, TaskBound fall
back to heuristic scope inference and records `scopeSource: llm_fallback` in JSON.

```yaml
- uses: Conalh/TaskBound@v0.2.0
- uses: Conalh/TaskBound@v0.2.1
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
with:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taskbound",
"version": "0.2.0",
"version": "0.2.1",
"description": "Post-session scope creep review for AI agent edits.",
"type": "module",
"bin": {
Expand Down
16 changes: 14 additions & 2 deletions src/scope-infer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { InferredScope } from './types.js';
import { taskMentionsSensitiveSurface } from './paths.js';

Expand Down Expand Up @@ -154,7 +154,7 @@
const extensions = new Set<string>();

for (const hint of EXTENSION_HINTS) {
if (hint.markers.some((marker) => normalized.includes(marker))) {
if (hint.markers.some((marker) => matchesMarker(normalized, marker))) {
for (const extension of hint.extensions) {
extensions.add(extension);
}
Expand Down Expand Up @@ -227,7 +227,7 @@
const directories = new Set<string>();

for (const hint of DIRECTORY_HINTS) {
if (hint.markers.some((marker) => normalized.includes(marker))) {
if (hint.markers.some((marker) => matchesMarker(normalized, marker))) {
for (const directory of hint.directories) {
directories.add(directory);
}
Expand All @@ -248,6 +248,14 @@
return [...directories];
}

function matchesMarker(text: string, marker: string): boolean {
if (marker.length <= 3) {
return new RegExp(`(^|[^a-z0-9])${escapeRegExp(marker)}([^a-z0-9]|$)`, 'i').test(text);
}

return text.includes(marker);
}

function buildScopeSummary(
explicitPaths: string[],
extensions: string[],
Expand Down Expand Up @@ -278,3 +286,7 @@

return summary;
}

function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
12 changes: 12 additions & 0 deletions test/scope-infer.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ test('scope inference accepts explicit directory scope context', () => {
assert.equal(isFileInScope('package.json', scope), false);
});

test('scope inference does not treat ci inside ordinary words as workflow scope', () => {
const scope = inferScope(
'Fix header CSS styling',
'## Summary\nFix header CSS spacing.\n\n## Scope\n- styles/header.css'
);

assert.equal(scope.extensions.includes('yml'), false);
assert.equal(scope.extensions.includes('yaml'), false);
assert.equal(scope.directories.includes('.github/workflows'), false);
assert.equal(isFileInScope('.github/workflows/demo-scope-creep.yml', scope), false);
});

test('file scope detector flags sensitive surfaces for CSS task', () => {
const findings = detectFileScope({
task: 'Fix header CSS styling',
Expand Down