dotnet-production-agent-skills 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/RELEASE_NOTES.md +58 -0
- package/copilot/production-instructions.md +4 -0
- package/dist/src/cli.js +6 -2
- package/dist/src/git-hook.js +32 -0
- package/hooks/commit-msg +16 -0
- package/package.json +1 -1
- package/skills/git-workflow/SKILL.md +11 -1
- package/skills/safe-terminal/SKILL.md +16 -2
- package/skills/safe-terminal/references/shell-recovery.md +39 -0
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ The catalog is grouped by task so agents can load only the guidance relevant to
|
|
|
163
163
|
| :--- | :--- | :--- |
|
|
164
164
|
| [`task-router`](skills/task-router/SKILL.md) | Classify requests to select the smallest proportionate workflow when the path forward is ambiguous. | — |
|
|
165
165
|
| [`context-reset`](skills/context-reset/SKILL.md) | Reorient safely when user instructions interrupt, pivot, or invalidate an in-progress coding task. | — |
|
|
166
|
-
| [`safe-terminal`](skills/safe-terminal/SKILL.md) | Execute shell commands safely, handle failures, and prevent accidental mutations or credential leaks. |
|
|
166
|
+
| [`safe-terminal`](skills/safe-terminal/SKILL.md) | Execute shell commands safely, handle failures, and prevent accidental mutations or credential leaks. | [shell-recovery](skills/safe-terminal/references/shell-recovery.md) |
|
|
167
167
|
| [`poc-development`](skills/poc-development/SKILL.md) | Build bounded, explicit spikes or prototypes to answer technical questions without cutting production corners prematurely. | — |
|
|
168
168
|
|
|
169
169
|
### 2. 🏗️ Architecture & Core Implementation
|
|
@@ -293,6 +293,22 @@ The CLI installs and manages guidance; it does not route prompts or load every s
|
|
|
293
293
|
|
|
294
294
|
The initial policy blocks force-push, destructive Git reset/clean/branch deletion, broad recursive deletion, and direct access to common credential-bearing files. Safe commands continue normally. Host configuration is written to `.codex/hooks.json`, `.github/hooks/dotnet-production-agent-skills.json`, `.claude/settings.json`, `.cursor/hooks.json`, or `.agents/hooks.json` for Antigravity.
|
|
295
295
|
|
|
296
|
+
### Reject co-author trailers with Git
|
|
297
|
+
|
|
298
|
+
After v0.3.3 is published, opt in from each repository:
|
|
299
|
+
|
|
300
|
+
```sh
|
|
301
|
+
npx dotnet-production-agent-skills@0.3.3 git-hook
|
|
302
|
+
# Preview, or select another repository
|
|
303
|
+
npx dotnet-production-agent-skills@0.3.3 git-hook --project <path> --dry-run
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
This installs an executable Git `commit-msg` hook that rejects case-insensitive `Co-authored-by:` lines in the final commit message, including `-m`, `-F`, template, and `--trailer` input. It rejects the commit without editing the message. Node.js must be available when Git runs. The installer respects Git's configured `core.hooksPath`, does not change Git configuration, and refuses to overwrite existing or modified hooks even with `--force`. For an existing hook manager, integrate the packaged `hooks/commit-msg` check manually. Skill install/update/uninstall does not manage this separately opted-in Git hook.
|
|
307
|
+
|
|
308
|
+
This local hook covers Git CLI commits from any agent or developer. It does not validate PR descriptions or GitHub/API-created commits, and `--no-verify` or disabling hooks can bypass it. Use a required server-side PR check to enforce the policy before merging API-created or bypassed commits. See [Git hook documentation](https://git-scm.com/docs/githooks#_commit_msg).
|
|
309
|
+
|
|
310
|
+
Terminal recovery guidance keeps commands anchored to the intended repository, separates executable lookup from repository selection, and forbids moving into Git/tool installation directories as a workaround. Copilot project instructions include the critical rules so they are available even before the focused `safe-terminal` skill is selected. Skills and instructions guide the model; the existing hooks do not enforce these directory/recovery rules. See the skill's [shell recovery examples](skills/safe-terminal/references/shell-recovery.md) for diagnostics and primary sources.
|
|
311
|
+
|
|
296
312
|
Copilot project installs manage only the text between `<!-- dotnet-production-agent-skills:start -->` and `<!-- dotnet-production-agent-skills:end -->`. Existing team instructions outside those markers remain intact. Uninstall removes only the managed section. User-scope Copilot installs install skills into `~/.copilot/skills`; repository instructions apply only to project scope.
|
|
297
313
|
|
|
298
314
|
```sh
|
|
@@ -316,6 +332,7 @@ Commands:
|
|
|
316
332
|
list Display available skills and current installation status
|
|
317
333
|
doctor Validate skill metadata and report host installation health
|
|
318
334
|
uninstall Safely remove only skills tracked by this package
|
|
335
|
+
git-hook Opt in to a Git commit-msg hook in the current/--project repository
|
|
319
336
|
```
|
|
320
337
|
|
|
321
338
|
### Options & Flags
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Release notes
|
|
2
2
|
|
|
3
|
+
## v0.3.3 — Strict coding-agent authorship rules
|
|
4
|
+
|
|
5
|
+
Prepared for release after PR #13 is merged; not yet published to npm.
|
|
6
|
+
|
|
7
|
+
### Improved
|
|
8
|
+
|
|
9
|
+
- Add an opt-in `git-hook` CLI command that installs a Git `commit-msg` hook rejecting case-insensitive `Co-authored-by:` lines in final commit messages. Respect `core.hooksPath`, support dry-run and explicit project paths, and preserve existing hooks without changing Git configuration.
|
|
10
|
+
- Strengthen the `git-workflow` skill, managed Copilot project instructions, and global engineering guardrails to prohibit `Co-authored-by:` trailers, equivalent co-author metadata, AI/agent signatures, and generated-by footers in commits and pull requests.
|
|
11
|
+
- Cover indirect attribution through commit trailers, templates, API fields, and Git author/committer identity overrides.
|
|
12
|
+
- Require inspection of complete proposed commit/PR messages before creation and new commits before pushing. If tooling inserts attribution, stop before publishing and report the blocker without bypassing hooks or rewriting existing commits.
|
|
13
|
+
|
|
14
|
+
### Compatibility and upgrade
|
|
15
|
+
|
|
16
|
+
- Existing CLI targets, scopes, flags, and copy/link modes are unchanged. Git hook installation is separate from skill installation and updates.
|
|
17
|
+
- After publication, run `npx dotnet-production-agent-skills@0.3.3 git-hook` inside each repository to opt in. Node.js must be available when Git runs. Existing hook managers require manual integration.
|
|
18
|
+
- The Git hook rejects co-author trailers locally; AI footers and PR text remain covered by agent instructions. API-created commits and hook bypasses require a server-side required check for merge enforcement.
|
|
19
|
+
- After publication, update installed skills with `npx dotnet-production-agent-skills@0.3.3 update --target all`. Add `--scope project` to refresh that project's managed Copilot instructions and installed skills. Review local edits before updating.
|
|
20
|
+
|
|
21
|
+
### Validation
|
|
22
|
+
|
|
23
|
+
`npm run validate` passed: all 31 skills validated, the TypeScript build passed, and all 23 tests passed. Git hook tests cover real commits with inline, file-based, and trailer-based messages, installer idempotency, conflict preservation, custom hook paths, and dry-run behavior. Whitespace checks passed.
|
|
24
|
+
|
|
25
|
+
## v0.3.2 — Repository-safe terminal recovery
|
|
26
|
+
|
|
27
|
+
Released in [`dotnet-production-agent-skills@0.3.2`](https://www.npmjs.com/package/dotnet-production-agent-skills/v/0.3.2).
|
|
28
|
+
|
|
29
|
+
### Improved
|
|
30
|
+
|
|
31
|
+
- Keep terminal commands anchored to the intended project. Never recover a failed project command by moving into Git or another tool's installation directory.
|
|
32
|
+
- Separate executable lookup from repository selection. Verify the intended Git root before mutations, preserve linked-worktree support, and inspect relevant Git overrides when an explicit project path selects an unexpected repository.
|
|
33
|
+
- Diagnose the submitted/executed command and first actionable error before retrying. Submit plain command text, preserve requested arguments, and avoid speculative shell, PATH, profile, configuration, or installation changes.
|
|
34
|
+
- Include the core recovery rules in managed Copilot project instructions and global engineering guidance, and connect Git workflows to `safe-terminal`.
|
|
35
|
+
|
|
36
|
+
### Documentation
|
|
37
|
+
|
|
38
|
+
- Add `references/shell-recovery.md` with PowerShell, Command Prompt, and Bash diagnostics, quoting/invocation examples, failure classification, and primary documentation sources.
|
|
39
|
+
- Advertise the reference in both the README and hosted skills catalog.
|
|
40
|
+
- Refresh the website release-notes page with clearer publication status and a new layout.
|
|
41
|
+
|
|
42
|
+
### Compatibility and upgrade
|
|
43
|
+
|
|
44
|
+
- CLI targets, scopes, flags, and copy/link modes are unchanged.
|
|
45
|
+
- These changes strengthen agent guidance; existing hooks do not enforce the new repository-directory recovery rules.
|
|
46
|
+
- Update installed skills with `npx dotnet-production-agent-skills@0.3.2 update --target all`. Run the update in project scope (`--scope project`) to refresh that project's managed Copilot instructions and installed skills. Review local edits before updating.
|
|
47
|
+
|
|
48
|
+
### Validation
|
|
49
|
+
|
|
50
|
+
`npm run validate` passed: 31 skills validated and 21 tests passed. Five recovery scenarios were evaluated independently as proposed commands; Windows commands were not executed on Windows. Catalog metadata, reference paths, and whitespace checks passed.
|
|
51
|
+
|
|
3
52
|
## v0.3.0 — Multi-agent hooks and Antigravity
|
|
4
53
|
|
|
5
54
|
### New
|
|
@@ -19,6 +68,15 @@
|
|
|
19
68
|
- GitHub release tags are authoritative for release-triggered npm publishes. A `v0.3.0` release aligns both package files to `0.3.0` before checking npm availability or publishing, even when the tagged commit still contains an already-published version.
|
|
20
69
|
- The workflow now fails early if the resolved tag version and `package.json` ever disagree, preventing an old package version from being checked or published accidentally.
|
|
21
70
|
|
|
71
|
+
## v0.3.1 — Safe terminal diagnostics
|
|
72
|
+
|
|
73
|
+
Released in [`dotnet-production-agent-skills@0.3.1`](https://www.npmjs.com/package/dotnet-production-agent-skills/v/0.3.1).
|
|
74
|
+
|
|
75
|
+
### Improved
|
|
76
|
+
|
|
77
|
+
- Updated `safe-terminal` to distinguish malformed or control-character input from an executable that is unavailable in the current shell.
|
|
78
|
+
- Added read-only executable lookup guidance for PowerShell, Command Prompt, and POSIX shells, plus evidence-based retry and environment-change safeguards.
|
|
79
|
+
|
|
22
80
|
## Unreleased — Redis caching skill
|
|
23
81
|
|
|
24
82
|
Proposed in [PR #6](https://github.com/dprakash2101/dotnet-production-agent-skills/pull/6); this change is not yet published to npm.
|
|
@@ -6,3 +6,7 @@ Never log secrets or sensitive payloads. Add operationally useful logs, and limi
|
|
|
6
6
|
Do not introduce retries automatically. Add them only when requested or required by existing architecture, and only for safe transient operations.
|
|
7
7
|
When behavior changes, check whether existing tests need updating. Avoid redundant tests that slow CI.
|
|
8
8
|
Run the smallest appropriate validation, build, or test command after changing code.
|
|
9
|
+
|
|
10
|
+
Strict authorship rule for every coding agent: never add `Co-authored-by:` trailers (case-insensitive), co-author metadata, AI/agent signatures, credits, or generated-by footers to commits or pull request titles/descriptions. Do not inject attribution through `--trailer`, templates, API fields, or author/committer identity overrides. Inspect the complete proposed commit/PR text and remove automatically suggested attribution before creation; inspect the new commits' full messages before pushing. If a hook, tool, or host adds attribution, stop before publishing and report the blocker. Do not bypass hooks, change configuration, amend existing commits, or rewrite published history without explicit authorization. Apply the git-workflow skill for the full procedure.
|
|
11
|
+
|
|
12
|
+
Before terminal commands, apply the safe-terminal skill and verify the actual shell and project working directory. After a failure, inspect the submitted/executed command and first actionable error before choosing a correction. Never add terminal control sequences or move into Git/tool installation folders as a workaround. Executable location and repository location are separate: keep commands in the project, verify Git's intended repository with `git -C "<project-path>" rev-parse --show-toplevel`, and use same-session executable lookup only for a genuine command-not-found error. Do not guess binary paths, switch shells, edit PATH/profiles/configuration, or reinstall tools to escape an unexplained failure. Retry only after an evidence-based correction; stop after at most three distinct corrections.
|
package/dist/src/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
9
9
|
import { changeInstructions, inspectInstructions } from "./copilot/instructions.js";
|
|
10
10
|
import { changeHooks, hookTargets, inspectHooks, removeSharedHookScript } from "./hooks.js";
|
|
11
11
|
import { validateSkills } from "./skills/validation.js";
|
|
12
|
+
import { installGitHook } from "./git-hook.js";
|
|
12
13
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
13
14
|
const SKILLS_ROOT = path.join(PACKAGE_ROOT, "skills");
|
|
14
15
|
const MANIFEST_NAME = ".dotnet-agent-skills.json";
|
|
@@ -22,6 +23,7 @@ Commands:
|
|
|
22
23
|
list List packaged skills and installation state
|
|
23
24
|
doctor Validate packaged skills and inspect installation health
|
|
24
25
|
uninstall Remove only skills tracked by this package
|
|
26
|
+
git-hook Opt in to a Git commit-msg hook in the current/--project repository
|
|
25
27
|
|
|
26
28
|
Options:
|
|
27
29
|
--target <all|shared|codex|copilot|claude|cursor|antigravity>
|
|
@@ -459,11 +461,13 @@ async function main() {
|
|
|
459
461
|
console.log(usage());
|
|
460
462
|
return;
|
|
461
463
|
}
|
|
462
|
-
const commands = new Set(["install", "update", "list", "doctor", "uninstall"]);
|
|
464
|
+
const commands = new Set(["install", "update", "list", "doctor", "uninstall", "git-hook"]);
|
|
463
465
|
if (!commands.has(parsed.command))
|
|
464
466
|
throw new Error(`unknown command: ${parsed.command}`);
|
|
465
467
|
const command = parsed.command;
|
|
466
|
-
if (command === "
|
|
468
|
+
if (command === "git-hook")
|
|
469
|
+
console.log(await installGitHook(parsed.options.project, PACKAGE_ROOT, parsed.options.dryRun));
|
|
470
|
+
else if (command === "install" || command === "update")
|
|
467
471
|
await installOrUpdate(parsed.options, command);
|
|
468
472
|
else if (command === "uninstall")
|
|
469
473
|
await uninstall(parsed.options);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { chmod, lstat, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
export async function installGitHook(project, packageRoot, dryRun) {
|
|
5
|
+
const result = spawnSync("git", ["rev-parse", "--git-path", "hooks/commit-msg"], { cwd: project, encoding: "utf8" });
|
|
6
|
+
if (result.error)
|
|
7
|
+
throw result.error;
|
|
8
|
+
if (result.status !== 0)
|
|
9
|
+
throw new Error(result.stderr.trim() || "Git repository required for git-hook.");
|
|
10
|
+
const destination = path.resolve(project, result.stdout.trim());
|
|
11
|
+
const source = await readFile(path.join(packageRoot, "hooks", "commit-msg"), "utf8");
|
|
12
|
+
let exists = false;
|
|
13
|
+
try {
|
|
14
|
+
const entry = await lstat(destination);
|
|
15
|
+
exists = true;
|
|
16
|
+
if (!entry.isFile() || await readFile(destination, "utf8") !== source) {
|
|
17
|
+
throw new Error(`Existing commit-msg hook preserved at ${destination}. Integrate the packaged hooks/commit-msg check into your hook manager manually.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
if (dryRun)
|
|
25
|
+
return `would ${exists ? "verify" : "install"} commit-msg hook: ${destination}`;
|
|
26
|
+
if (!exists) {
|
|
27
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
28
|
+
await writeFile(destination, source, { flag: "wx", mode: 0o755 });
|
|
29
|
+
}
|
|
30
|
+
await chmod(destination, 0o755);
|
|
31
|
+
return `${exists ? "verified" : "installed"} commit-msg hook: ${destination}`;
|
|
32
|
+
}
|
package/hooks/commit-msg
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// dotnet-production-agent-skills: reject co-author attribution in the final message.
|
|
4
|
+
(async () => {
|
|
5
|
+
const { readFile } = await import("node:fs/promises");
|
|
6
|
+
const file = process.argv[2];
|
|
7
|
+
if (!file) throw new Error("Expected the commit message file path.");
|
|
8
|
+
const message = await readFile(file, "utf8");
|
|
9
|
+
if (/^\s*co-authored-by\s*:/im.test(message)) {
|
|
10
|
+
process.stderr.write("Commit rejected: Co-authored-by trailers are forbidden. Remove the attribution and retry; do not bypass the hook.\n");
|
|
11
|
+
process.exitCode = 1;
|
|
12
|
+
}
|
|
13
|
+
})().catch((error) => {
|
|
14
|
+
process.stderr.write(`Commit message validation failed: ${error.message}\n`);
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
});
|
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@ description: Perform safe Git branch, stage, commit, and push operations for eng
|
|
|
5
5
|
|
|
6
6
|
# Fast, safe Git workflow
|
|
7
7
|
|
|
8
|
+
Apply `safe-terminal` before execution and on command failure. Keep the working directory in the intended project, verify the repository root when context is not established, and never recover by moving into Git's installation folder. Executable lookup does not select the repository. Split diagnostic recovery from the mutation sequence below; resume only when the cause is corrected and repository context is verified.
|
|
9
|
+
|
|
8
10
|
Minimize terminal calls and token-heavy output without weakening review. Batch compatible Git commands into the fewest practical invocations, and reuse branch, status, diff, validation, and remote facts already established in the current task when no intervening operation could have changed them. Do not issue one tool call per Git command by default.
|
|
9
11
|
|
|
10
12
|
For a fresh preflight, prefer one combined inspection such as `git status --short --branch` instead of separate status and branch commands. Inspect only the relevant diff; do not repeat a full diff review that was just completed.
|
|
@@ -18,7 +20,15 @@ Branch names:
|
|
|
18
20
|
|
|
19
21
|
Reuse a Jira ID from the current branch or user input. Never invent one; ask if the requested operation requires an unavailable ID.
|
|
20
22
|
|
|
21
|
-
Commit messages begin with the Jira ID, for example `XDCI-12345 Add order webhook retry handling`.
|
|
23
|
+
Commit messages begin with the Jira ID, for example `XDCI-12345 Add order webhook retry handling`.
|
|
24
|
+
|
|
25
|
+
## Strict authorship policy
|
|
26
|
+
|
|
27
|
+
- Never add `Co-authored-by:` trailers (case-insensitive), co-author metadata, or equivalent attribution to commits or pull requests. This applies to every coding agent, including GitHub Copilot, Codex, Claude, and Cursor.
|
|
28
|
+
- Never append AI/agent signatures, credits, or footers such as "Generated with Copilot" or "Assisted by Claude" to commit messages or pull request titles/descriptions.
|
|
29
|
+
- Do not supply attribution through `git commit --trailer`, commit-message templates, API fields, or another indirect mechanism. Do not change the configured Git author/committer identity or use `--author` to credit an agent.
|
|
30
|
+
- Before creating a commit or pull request, inspect the complete proposed message, including its body and trailers, and remove any automatically suggested attribution. Before pushing, inspect the new commits' complete messages with `git log <base>..HEAD --format=full` and verify the same policy.
|
|
31
|
+
- If a hook, tool, or host adds forbidden attribution, stop before publishing and report the blocker. Do not bypass hooks, change tool configuration, amend existing commits, or rewrite published history without explicit authorization.
|
|
22
32
|
|
|
23
33
|
Before committing, confirm required validation and scan the intended changes for secrets/artifacts. Do not include unrelated changes. Do not change Git identity, credentials, credential helpers, or authentication configuration.
|
|
24
34
|
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: safe-terminal
|
|
3
|
-
description:
|
|
3
|
+
description: Apply before terminal or Git execution and when recovering from malformed commands, executable lookup failures, wrong working directories, or shell errors. Preserve repository context, diagnose the actual error, and prevent speculative installation-path or environment workarounds.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Safe terminal
|
|
7
7
|
|
|
8
8
|
Before execution, verify the command, shell, working directory, resolved target, quoting, and likely side effects. Prefer read-only inspection before mutation and narrow explicit paths over broad globs or unresolved variables.
|
|
9
9
|
|
|
10
|
+
## Keep executable location separate from repository context
|
|
11
|
+
|
|
12
|
+
Keep the working directory anchored to the user's project. The directory containing `git.exe`, a shell executable, or other CLI binaries is **not** the repository. Never `cd` into a tool installation directory or set the terminal tool's `cwd`/`workdir` there to recover a project command. Never use Git's installation directory as `git -C`, `--git-dir`, or `--work-tree`.
|
|
13
|
+
|
|
14
|
+
- Use the terminal tool's explicit working-directory parameter when available. Otherwise use shell-correct navigation to the verified project path and stop if navigation fails. Do not assume a previous terminal call's `cd` persists.
|
|
15
|
+
- For Git repository operations, establish the intended project from workspace/task evidence, then verify `git -C "<project-path>" rev-parse --show-toplevel`. Confirm that the returned root is the intended repository before mutation; a successful command in an unrelated repository is not success. Allow a subdirectory or linked worktree; do not require `.git` to be a directory.
|
|
16
|
+
- If a command fails with “not a git repository,” Git already started. Investigate the project path and repository context, not installation or `PATH`. If the root is unknown or ambiguous, stop and ask for the project location; do not search installation folders, initialize a repository, or guess another checkout.
|
|
17
|
+
- A resolved absolute executable path may be used only after same-session lookup establishes a genuine executable-resolution problem. Invoke that binary **from the project directory**, retain the requested arguments, and use the actual shell's quoting/invocation syntax. Do not confuse invoking an installed binary with running a project command from its installation folder.
|
|
18
|
+
- If an explicit project path still selects an unexpected repository, inspect only relevant overrides (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`), without dumping the environment. Do not clear them, set replacement overrides, or edit configuration without understanding their purpose and obtaining authorization where required.
|
|
19
|
+
|
|
10
20
|
## Inspect what the shell actually ran
|
|
11
21
|
|
|
12
22
|
When a command fails, compare the submitted text, the command displayed by the terminal, and the executable named in the error. A copied command can contain invisible bytes or terminal control sequences, while the shell or tool host may strip or interpret them before execution. A caret rendering such as `^X` is a clue to inspect, not proof that it reached the shell as part of the executable name.
|
|
@@ -17,11 +27,15 @@ When a command fails, compare the submitted text, the command displayed by the t
|
|
|
17
27
|
|
|
18
28
|
Check typos, flags, quoting, shell-specific syntax, working directory, paths, and missing arguments only where the command or output supports them. Preserve the user's requested operation and options; do not drop build, restore, test, or safety flags just to make the command run.
|
|
19
29
|
|
|
30
|
+
Submit plain command text. Do not prepend terminal keyboard shortcuts, control bytes, escape sequences, or copied prompt text to clear or repair a command line. If submitted and executed text differ repeatedly, inspect the terminal/tool transport or report that blocker; do not keep adding control sequences.
|
|
31
|
+
|
|
20
32
|
## Diagnose an unavailable executable
|
|
21
33
|
|
|
22
34
|
For a command-not-found error, use read-only checks in the **same shell/session** that failed. In PowerShell, use `Get-Command <name> -All` and, where useful, `where.exe <name>`; in cmd use `where <name>`; in POSIX shells use `command -v <name>`. Check the current `PATH` without printing credentials or unrelated environment values. If the tool is found, distinguish a typo or wrong shell from an executable that is present but absent from that process's `PATH`. If it is not found, report that the tool is unavailable in this environment; do not guess its installation path or repeatedly run the same command.
|
|
23
35
|
|
|
24
|
-
Use an already configured shell or approved tool runner when it resolves the issue without changing project configuration. Do not respond to a malformed command by installing software, editing `PATH` or shell profiles, changing credentials, or changing tool configuration. Require evidence and appropriate authorization for environment changes.
|
|
36
|
+
Use an already configured shell or approved tool runner only when evidence shows it resolves the issue without changing project configuration; preserve and reverify the project directory in that environment. Do not switch shells just to bypass a parsing error, execution policy, or approval. Do not respond to a malformed command by installing software, editing `PATH` or shell profiles, changing credentials, or changing tool configuration. Require evidence and appropriate authorization for environment changes.
|
|
37
|
+
|
|
38
|
+
Use [shell recovery examples](references/shell-recovery.md) when choosing shell-specific diagnostics or distinguishing executable lookup from repository/path failures.
|
|
25
39
|
|
|
26
40
|
## Correct, retry, verify
|
|
27
41
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Shell recovery examples
|
|
2
|
+
|
|
3
|
+
Use these as diagnostic patterns, not commands to run unconditionally. Replace placeholders only with paths established from task/workspace evidence. Keep checks read-only and in the failing shell; do not print the full environment.
|
|
4
|
+
|
|
5
|
+
## Choose the diagnostic for the actual shell
|
|
6
|
+
|
|
7
|
+
| Check | PowerShell | cmd.exe | Bash / POSIX shell |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| Current directory | `Get-Location` | `cd` | `pwd` |
|
|
10
|
+
| Executable resolution | `Get-Command git -All` | `where git` | `command -v git` |
|
|
11
|
+
| Verify project repository | `git -C "<project-path>" rev-parse --show-toplevel` | Same | Same |
|
|
12
|
+
|
|
13
|
+
When navigation is required, use `Set-Location -LiteralPath '<project-path>' -ErrorAction Stop` in PowerShell, `cd /d "<project-path>"` in cmd (including drive changes), or `cd -- "<project-path>"` in Bash. Stop on failure; never run the project operation after failed navigation. Prefer a tool-provided working directory instead.
|
|
14
|
+
|
|
15
|
+
If same-session lookup proves a bare executable name cannot resolve but identifies the installed binary, keep the project working directory and invoke the resolved executable. PowerShell requires `& '<resolved-git.exe-path>' -C '<project-path>' status`; cmd uses `"<resolved-git.exe-path>" -C "<project-path>" status`; Bash uses `"<resolved-git-path>" -C "<project-path>" status`. Pass arguments separately; do not evaluate a generated command string. These are conditional examples, not permission to guess binary locations.
|
|
16
|
+
|
|
17
|
+
## Classify failures before recovery
|
|
18
|
+
|
|
19
|
+
| Evidence | Next step | Do not infer or do |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| Executed executable token contains pasted prompt/control text | Reconstruct plain intended tokens; retry once if authorized | Guess an installation path or alter PATH |
|
|
22
|
+
| Submitted text looks corrupted, but error names the intended executable | Inspect actual executable resolution in that session | Assume the visible corruption caused command-not-found |
|
|
23
|
+
| Git reports that the directory is not a repository | Verify workspace path and root using `git -C` | Reinstall Git, move into its installation, or run `git init` |
|
|
24
|
+
| Quoted executable path produces a PowerShell parsing/invocation error | Correct invocation syntax with `&`; retain arguments and project path | Switch shells or concatenate executable and arguments into one string |
|
|
25
|
+
| Project path has spaces or cmd is on another drive | Correct quoting/navigation, verify the resulting directory | Treat the executable's containing folder as the project |
|
|
26
|
+
| Verified project returns an unexpected Git root | Inspect relevant repository overrides and workspace identity | Clear overrides blindly or mutate the other repository |
|
|
27
|
+
| New session starts in a tool installation folder | Set explicit verified project context before repository operations | Assume a prior session's `cd` persisted |
|
|
28
|
+
| Clean command still cannot resolve and no binary is found | Report tool unavailable in that shell/environment | Retry repeatedly or silently install/reconfigure |
|
|
29
|
+
|
|
30
|
+
## Sources and enforcement boundary
|
|
31
|
+
|
|
32
|
+
- [Git command options and environment](https://git-scm.com/docs/git): `-C` selects command context; executable location does not select a repository.
|
|
33
|
+
- [Git repository-root inspection](https://git-scm.com/docs/git-rev-parse): `--show-toplevel` reports the working tree root.
|
|
34
|
+
- [PowerShell call operator](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators#call-operator-): invoke a quoted executable with `&` and separate arguments.
|
|
35
|
+
- [cmd directory navigation](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd): `/d` changes the drive as well as the directory.
|
|
36
|
+
- [VS Code agent skills](https://code.visualstudio.com/docs/agent-customization/agent-skills) and [instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions): keep critical recovery rules in project instructions as well as the focused skill.
|
|
37
|
+
- [VS Code hooks](https://code.visualstudio.com/docs/agent-customization/hooks): host-supported hooks can enforce policy independently of model guidance; schemas and behavior differ by harness.
|
|
38
|
+
|
|
39
|
+
Treat this skill as behavioral guidance, not a sandbox or guaranteed block. Existing package hooks do not enforce repository-directory recovery. Verify hook support and actual payloads before adding enforcement; do not invent a portable hook format or claim instruction text guarantees compliance.
|