pi-agentsmd 0.1.2 → 0.1.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/CHANGELOG.md +6 -0
- package/package.json +3 -2
- package/src/index.ts +1 -1
- package/src/init.ts +2 -2
- package/src/prompt.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3 - 2026-07-17
|
|
4
|
+
|
|
3
5
|
All notable changes to this project will be documented in this file.
|
|
4
6
|
|
|
5
7
|
This project follows the spirit of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and uses semantic versioning for releases.
|
|
6
8
|
|
|
7
9
|
## [Unreleased]
|
|
8
10
|
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Make `/init --force` and `/init -f` explicitly authorize replacing `AGENTS.md`.
|
|
14
|
+
|
|
9
15
|
## [0.1.2] - 2026-07-01
|
|
10
16
|
|
|
11
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agentsmd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Generate AGENTS.md contributor guides for Pi repositories.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"check": "tsc --noEmit",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "rm -rf .test-dist && tsc --noEmit false --outDir .test-dist && cp -R prompts .test-dist/prompts && node --test tests/*.test.mjs",
|
|
49
50
|
"pack:dry-run": "npm pack --dry-run"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@earendil-works/pi-coding-agent": "^0.80.0",
|
|
56
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^26.1.0",
|
|
57
58
|
"typescript": "^6.0.3"
|
|
58
59
|
},
|
|
59
60
|
"publishConfig": {
|
package/src/index.ts
CHANGED
package/src/init.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { INIT_PROMPT } from "./prompt.js";
|
|
4
|
+
import { FORCE_INIT_PROMPT, INIT_PROMPT } from "./prompt.js";
|
|
5
5
|
|
|
6
6
|
const DEFAULT_AGENTS_MD_FILENAME = "AGENTS.md";
|
|
7
7
|
|
|
@@ -23,5 +23,5 @@ export async function handleInitCommand(
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
pi.sendUserMessage(INIT_PROMPT);
|
|
26
|
+
pi.sendUserMessage(force ? FORCE_INIT_PROMPT : INIT_PROMPT);
|
|
27
27
|
}
|
package/src/prompt.ts
CHANGED
|
@@ -3,8 +3,21 @@ import { join, dirname } from "node:path";
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const NO_OVERWRITE_INSTRUCTION =
|
|
7
|
+
"Before writing, check whether AGENTS.md already exists in the current working directory. If it does, do not overwrite or modify it.";
|
|
8
|
+
const FORCE_OVERWRITE_INSTRUCTION =
|
|
9
|
+
"The user explicitly invoked /init with --force. Replace AGENTS.md in the current working directory, even if it already exists. Do not modify any other existing files.";
|
|
6
10
|
|
|
7
11
|
export const INIT_PROMPT = readFileSync(
|
|
8
12
|
join(__dirname, "../prompts/init.md"),
|
|
9
13
|
"utf8",
|
|
10
14
|
);
|
|
15
|
+
|
|
16
|
+
export const FORCE_INIT_PROMPT = INIT_PROMPT.replace(
|
|
17
|
+
NO_OVERWRITE_INSTRUCTION,
|
|
18
|
+
FORCE_OVERWRITE_INSTRUCTION,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (FORCE_INIT_PROMPT === INIT_PROMPT) {
|
|
22
|
+
throw new Error("Init prompt no-overwrite instruction is missing.");
|
|
23
|
+
}
|