mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
docs: rename workspace agents template
This commit is contained in:
@@ -786,7 +786,11 @@
|
||||
},
|
||||
{
|
||||
"source": "/templates/AGENTS",
|
||||
"destination": "/reference/templates/AGENTS"
|
||||
"destination": "/reference/templates/agents-template"
|
||||
},
|
||||
{
|
||||
"source": "/reference/templates/AGENTS",
|
||||
"destination": "/reference/templates/agents-template"
|
||||
},
|
||||
{
|
||||
"source": "/templates/BOOT",
|
||||
@@ -1792,7 +1796,7 @@
|
||||
"group": "Templates",
|
||||
"pages": [
|
||||
"reference/AGENTS.default",
|
||||
"reference/templates/AGENTS",
|
||||
"reference/templates/agents-template",
|
||||
"reference/templates/BOOT",
|
||||
"reference/templates/BOOTSTRAP",
|
||||
"reference/templates/HEARTBEAT",
|
||||
|
||||
@@ -19,7 +19,7 @@ mkdir -p ~/.openclaw/workspace
|
||||
2. Copy the default workspace templates into the workspace:
|
||||
|
||||
```bash
|
||||
cp docs/reference/templates/AGENTS.md ~/.openclaw/workspace/AGENTS.md
|
||||
cp docs/reference/templates/agents-template.md ~/.openclaw/workspace/AGENTS.md
|
||||
cp docs/reference/templates/SOUL.md ~/.openclaw/workspace/SOUL.md
|
||||
cp docs/reference/templates/TOOLS.md ~/.openclaw/workspace/TOOLS.md
|
||||
```
|
||||
|
||||
@@ -86,5 +86,5 @@ We shook hand-to-claw that day. I shall never forget it.
|
||||
|
||||
## Related
|
||||
|
||||
- [AGENTS.md template](/reference/templates/AGENTS)
|
||||
- [AGENTS.md template](/reference/templates/agents-template)
|
||||
- [Default AGENTS.md](/reference/AGENTS.default)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
AGENTS.md
|
||||
@@ -24,7 +24,7 @@ For a complete map of the docs, see [Docs hubs](/start/hubs).
|
||||
- [OpenClaw assistant setup](/start/openclaw)
|
||||
- [Skills](/tools/skills)
|
||||
- [Skills config](/tools/skills-config)
|
||||
- [Workspace templates](/reference/templates/AGENTS)
|
||||
- [Workspace templates](/reference/templates/agents-template)
|
||||
- [RPC adapters](/reference/rpc)
|
||||
- [Gateway runbook](/gateway)
|
||||
- [Nodes (iOS and Android)](/nodes)
|
||||
|
||||
@@ -178,7 +178,7 @@ Use these hubs to discover every page, including deep dives and reference docs t
|
||||
- [ClawHub](/clawhub)
|
||||
- [Skills config](/tools/skills-config)
|
||||
- [Default AGENTS](/reference/AGENTS.default)
|
||||
- [Templates: AGENTS](/reference/templates/AGENTS)
|
||||
- [Templates: AGENTS](/reference/templates/agents-template)
|
||||
- [Templates: BOOTSTRAP](/reference/templates/BOOTSTRAP)
|
||||
- [Templates: HEARTBEAT](/reference/templates/HEARTBEAT)
|
||||
- [Templates: IDENTITY](/reference/templates/IDENTITY)
|
||||
|
||||
@@ -8,7 +8,7 @@ import { dirname, join } from "node:path";
|
||||
* Template pack files that must be present in installed packages.
|
||||
*/
|
||||
export const WORKSPACE_TEMPLATE_PACK_PATHS = [
|
||||
"docs/reference/templates/AGENTS.md",
|
||||
"docs/reference/templates/agents-template.md",
|
||||
"docs/reference/templates/SOUL.md",
|
||||
"docs/reference/templates/TOOLS.md",
|
||||
"docs/reference/templates/IDENTITY.md",
|
||||
|
||||
@@ -155,6 +155,19 @@ describe("ensureAgentWorkspace", () => {
|
||||
await expectPathMissing(path.join(tempDir, ...WORKSPACE_STATE_PATH_SEGMENTS));
|
||||
});
|
||||
|
||||
it("seeds workspace AGENTS.md from the non-instruction template source", async () => {
|
||||
const tempDir = await makeTempWorkspace("openclaw-workspace-");
|
||||
|
||||
await ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true });
|
||||
|
||||
const agents = await fs.readFile(path.join(tempDir, DEFAULT_AGENTS_FILENAME), "utf-8");
|
||||
const template = await fs.readFile(
|
||||
path.join("docs", "reference", "templates", "agents-template.md"),
|
||||
"utf-8",
|
||||
);
|
||||
expect(agents).toBe(template.replace(/^---[\s\S]*?\n---\s*/, ""));
|
||||
});
|
||||
|
||||
it("refuses to re-seed a recently attested workspace after only generated remnants survive", async () => {
|
||||
const tempDir = await makeTempWorkspace("openclaw-workspace-");
|
||||
await ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true });
|
||||
|
||||
@@ -49,6 +49,9 @@ const WORKSPACE_ONBOARDING_PROFILE_FILENAMES = [
|
||||
DEFAULT_IDENTITY_FILENAME,
|
||||
DEFAULT_USER_FILENAME,
|
||||
] as const;
|
||||
const WORKSPACE_TEMPLATE_SOURCE_FILENAMES: ReadonlyMap<string, string> = new Map([
|
||||
[DEFAULT_AGENTS_FILENAME, "agents-template.md"],
|
||||
]);
|
||||
|
||||
const workspaceTemplateCache = new Map<string, Promise<string>>();
|
||||
let gitAvailabilityPromise: Promise<boolean> | null = null;
|
||||
@@ -128,8 +131,9 @@ async function loadTemplate(name: string): Promise<string> {
|
||||
? [await resolveWorkspaceTemplateDir()]
|
||||
: await resolveWorkspaceTemplateSearchDirs();
|
||||
const triedPaths: string[] = [];
|
||||
const templateSourceName = WORKSPACE_TEMPLATE_SOURCE_FILENAMES.get(name) ?? name;
|
||||
for (const templateDir of templateDirs) {
|
||||
const templatePath = path.join(templateDir, name);
|
||||
const templatePath = path.join(templateDir, templateSourceName);
|
||||
triedPaths.push(templatePath);
|
||||
try {
|
||||
const content = await fs.readFile(templatePath, "utf-8");
|
||||
|
||||
Reference in New Issue
Block a user