@zwbcoding/agent-nav 0.1.0
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/LICENSE +21 -0
- package/README.md +9 -0
- package/bin/agent-nav.js +16 -0
- package/lib/init.js +57 -0
- package/package.json +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zwb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/bin/agent-nav.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { init } from "../lib/init.js";
|
|
4
|
+
|
|
5
|
+
const [command, target] = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
if (command === "init") {
|
|
8
|
+
try {
|
|
9
|
+
await init(target ?? ".");
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(`agent-nav: ${error.message}`);
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
console.log("Usage: agent-nav init <directory>");
|
|
16
|
+
}
|
package/lib/init.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { access, mkdir, readdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
const directories = [
|
|
5
|
+
["code", "存放完整项目代码。"],
|
|
6
|
+
["docs", "存放所有项目文档。"],
|
|
7
|
+
["docs/demand", "存放需求文档。"],
|
|
8
|
+
["docs/test", "存放测试文档。"],
|
|
9
|
+
["docs/design", "存放设计文档。"],
|
|
10
|
+
["docs/meet", "存放会议记录。"],
|
|
11
|
+
["docs/record", "存放项目记录。"],
|
|
12
|
+
["deploy", "存放部署和运维相关记录。"],
|
|
13
|
+
["deploy/log", "存放部署与运维日志。"],
|
|
14
|
+
["deploy/env", "存放部署环境相关信息。"],
|
|
15
|
+
["deploy/info", "存放部署与运维说明信息。"],
|
|
16
|
+
["guide", "存放向导和索引文件。"],
|
|
17
|
+
["agent", "存放不同 Coding Agent 的入口适配文件。"],
|
|
18
|
+
["agent/codex", "存放 Codex 入口适配文件。"],
|
|
19
|
+
["agent/claudecode", "存放 Claude Code 入口适配文件。"],
|
|
20
|
+
["command", "存放自动化脚本或命令。"],
|
|
21
|
+
["spec", "存放项目规约文件。"],
|
|
22
|
+
["workflow", "存放可定制、可组合的工作流定义。"],
|
|
23
|
+
["cli", "存放命令行交互相关内容。"],
|
|
24
|
+
["data", "存放项目数据。"],
|
|
25
|
+
["view", "可选目录,用于为用户提供界面向导。"]
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export async function init(target) {
|
|
29
|
+
const root = path.resolve(target);
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await access(root);
|
|
33
|
+
if ((await readdir(root)).length > 0) {
|
|
34
|
+
throw new Error(`target is not empty: ${root}`);
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error.code !== "ENOENT") throw error;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await mkdir(root, { recursive: true });
|
|
41
|
+
await writeFile(
|
|
42
|
+
path.join(root, "README.md"),
|
|
43
|
+
"# AI Agent 导航包\n\n用于汇聚项目资料,并通过统一目录向 AI 提供项目的最新进展、规约与当前情况。\n",
|
|
44
|
+
"utf8"
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
await Promise.all(
|
|
48
|
+
directories.map(async ([directory, description]) => {
|
|
49
|
+
const destination = path.join(root, directory);
|
|
50
|
+
const name = path.basename(directory);
|
|
51
|
+
await mkdir(destination, { recursive: true });
|
|
52
|
+
await writeFile(path.join(destination, "README.md"), `# ${name}\n\n${description}\n`, "utf8");
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
console.log(`Created AI agent navigation workspace: ${root}`);
|
|
57
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zwbcoding/agent-nav",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create a lightweight AI agent navigation workspace.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agent-nav": "bin/agent-nav.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"lib",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"ai-agent",
|
|
21
|
+
"codex",
|
|
22
|
+
"claude-code",
|
|
23
|
+
"workflow"
|
|
24
|
+
]
|
|
25
|
+
}
|