@guiho/xdocs 0.2.1 → 0.2.2
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 +4 -0
- package/DOCS.md +2 -2
- package/jsr.json +1 -1
- package/library/agents.d.ts +3 -1
- package/library/agents.d.ts.map +1 -1
- package/library/agents.js +12 -5
- package/library/prompts.d.ts +5 -3
- package/library/prompts.d.ts.map +1 -1
- package/library/prompts.js +20 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# GUIHO XDocs Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- Fix: the published library crashed under Node (`ERR_UNKNOWN_FILE_EXTENSION` for `.md`) because the prompts and the `guiho-as-xdocs` skill were loaded with Bun-only text imports. They are now read from disk at runtime (`readFileSync` relative to `import.meta.url`), so the `xdocs` CLI and the library work under both Node and Bun.
|
|
6
|
+
|
|
3
7
|
## 0.2.1
|
|
4
8
|
|
|
5
9
|
- Clarify the repository model: a repository has exactly one `XDOCS.md` (no frontmatter) that indexes its packages and applications, and each package/application has its own root `.xdocs.md` (with frontmatter and `parent: null`) that tops its tree.
|
package/DOCS.md
CHANGED
|
@@ -11,7 +11,7 @@ XDocs is a documentation tool, not a versioning tool. It never bumps versions or
|
|
|
11
11
|
## Package Overview
|
|
12
12
|
|
|
13
13
|
- Package name: `@guiho/xdocs`
|
|
14
|
-
- Runtime
|
|
14
|
+
- Runtime: Node (>= 18) and Bun (ESM)
|
|
15
15
|
- Package type: ESM
|
|
16
16
|
- Library entrypoint: `source/guiho-xdocs.ts`
|
|
17
17
|
- CLI entrypoint: `source/guiho-xdocs-bin.ts`
|
|
@@ -468,7 +468,7 @@ Compile the standalone binary:
|
|
|
468
468
|
bun run binary
|
|
469
469
|
```
|
|
470
470
|
|
|
471
|
-
The
|
|
471
|
+
The library reads the prompt templates and the `guiho-as-xdocs` skill from the package's `prompts/` and `skills/` directories at runtime (via `readFileSync` relative to `import.meta.url`), so the published package works under both Node and Bun.
|
|
472
472
|
|
|
473
473
|
## Documentation Requirement Before Publishing
|
|
474
474
|
|
package/jsr.json
CHANGED
package/library/agents.d.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
import type { XDocsAgentAutomationResult, XDocsAgentSettings, XDocsAgentTool, XDocsAgentsInstructionsResult, XDocsCliOptions, XDocsSkillInstallResult, XDocsSkillScope } from './types.js';
|
|
13
13
|
/** Canonical name of the xdocs agent skill. */
|
|
14
14
|
export declare const xdocsSkillName = "guiho-as-xdocs";
|
|
15
|
-
/** Raw contents of the bundled guiho-as-xdocs/SKILL.md
|
|
15
|
+
/** Raw contents of the bundled guiho-as-xdocs/SKILL.md, read from disk at
|
|
16
|
+
* runtime (relative to this module) so the compiled library works under both
|
|
17
|
+
* Node and Bun. The file ships with the package in `skills/`. */
|
|
16
18
|
export declare const xdocsSkillContent: string;
|
|
17
19
|
/** All AI tools the skill can be installed for. `agents` is the standard. */
|
|
18
20
|
export declare const xdocsAgentTools: readonly XDocsAgentTool[];
|
package/library/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../source/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../source/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EACvB,eAAe,EAChB,MAAM,YAAY,CAAA;AAInB,+CAA+C;AAC/C,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAE9C;;iEAEiE;AACjE,eAAO,MAAM,iBAAiB,EAAE,MAM5B,CAAA;AAEJ,6EAA6E;AAC7E,eAAO,MAAM,eA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AAE,CAInC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAU,KAAK,MAAM,EAAE,gBAAc,KAAG,OAAO,CAAC,6BAA6B,CAkBjH,CAAA;AAgBD,sDAAsD;AACtD,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAWrD,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,GAAU,SAAS,eAAe,KAAG,OAAO,CAAC,kBAAkB,CAI/F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,sBAAsB,EAC/B,SAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,IAAe,KAC3C,OAAO,CAAC,0BAA0B,CAkBpC,CAAA"}
|
package/library/agents.js
CHANGED
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
* 2. The large guiho-as-xdocs skill file, installed (local or global) into the
|
|
10
10
|
* skills directory of one or more AI tools.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
import skillRaw from '../skills/guiho-as-xdocs/SKILL.md' with { type: 'text' };
|
|
14
|
-
import { existsSync } from 'node:fs';
|
|
12
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
15
13
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
16
14
|
import { homedir } from 'node:os';
|
|
17
15
|
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
@@ -19,8 +17,17 @@ import { discoverConfig, normalizeAgentSettings } from './config.js';
|
|
|
19
17
|
import { XDocsError } from './errors.js';
|
|
20
18
|
/** Canonical name of the xdocs agent skill. */
|
|
21
19
|
export const xdocsSkillName = 'guiho-as-xdocs';
|
|
22
|
-
/** Raw contents of the bundled guiho-as-xdocs/SKILL.md
|
|
23
|
-
|
|
20
|
+
/** Raw contents of the bundled guiho-as-xdocs/SKILL.md, read from disk at
|
|
21
|
+
* runtime (relative to this module) so the compiled library works under both
|
|
22
|
+
* Node and Bun. The file ships with the package in `skills/`. */
|
|
23
|
+
export const xdocsSkillContent = (() => {
|
|
24
|
+
try {
|
|
25
|
+
return readFileSync(new URL('../skills/guiho-as-xdocs/SKILL.md', import.meta.url), 'utf8');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
24
31
|
/** All AI tools the skill can be installed for. `agents` is the standard. */
|
|
25
32
|
export const xdocsAgentTools = ['agents', 'claude'];
|
|
26
33
|
/** The standard, always-default skill target (AGENTS.md + .agents/skills). */
|
package/library/prompts.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
3
|
*
|
|
4
|
-
* Prompt loader.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Prompt loader. Prompt `.md` files are read from disk at runtime (relative to
|
|
5
|
+
* this module via import.meta.url) so the compiled library works under both
|
|
6
|
+
* Node and Bun. Each `.md` file ships with the package in `prompts/`. Adding a
|
|
7
|
+
* new prompt requires creating the `.md` file and adding its name to
|
|
8
|
+
* PROMPT_NAMES.
|
|
7
9
|
*/
|
|
8
10
|
import type { XDocsPrompt } from './types.js';
|
|
9
11
|
/** All available prompts, keyed by name. */
|
package/library/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../source/prompts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../source/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAmC7C,4CAA4C;AAC5C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAWjD,CAAA;AAEJ,gDAAgD;AAChD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,WAAW,GAAG,SACpC,CAAA;AAEnB,4BAA4B;AAC5B,eAAO,MAAM,cAAc,QAAO,MAAM,EACnB,CAAA"}
|
package/library/prompts.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
|
|
3
3
|
*
|
|
4
|
-
* Prompt loader.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Prompt loader. Prompt `.md` files are read from disk at runtime (relative to
|
|
5
|
+
* this module via import.meta.url) so the compiled library works under both
|
|
6
|
+
* Node and Bun. Each `.md` file ships with the package in `prompts/`. Adding a
|
|
7
|
+
* new prompt requires creating the `.md` file and adding its name to
|
|
8
|
+
* PROMPT_NAMES.
|
|
7
9
|
*/
|
|
8
|
-
|
|
9
|
-
import writeRaw from '../prompts/write.md' with { type: 'text' };
|
|
10
|
-
// @ts-expect-error -- Bun text import, no TS declaration needed
|
|
11
|
-
import updateRaw from '../prompts/update.md' with { type: 'text' };
|
|
12
|
-
// @ts-expect-error -- Bun text import, no TS declaration needed
|
|
13
|
-
import agentsRaw from '../prompts/agents.md' with { type: 'text' };
|
|
14
|
-
// @ts-expect-error -- Bun text import, no TS declaration needed
|
|
15
|
-
import generateRaw from '../prompts/generate.md' with { type: 'text' };
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
16
11
|
import { extractFrontmatter } from './metadata.js';
|
|
17
|
-
const
|
|
12
|
+
const PROMPT_NAMES = ['write', 'update', 'agents', 'generate'];
|
|
13
|
+
/** Read a prompt file's raw contents, or undefined when it cannot be read. */
|
|
14
|
+
const readPromptFile = (name) => {
|
|
15
|
+
try {
|
|
16
|
+
return readFileSync(new URL(`../prompts/${name}.md`, import.meta.url), 'utf8');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
18
22
|
/** Parse a raw prompt file into an XDocsPrompt. */
|
|
19
23
|
const parsePrompt = (raw) => {
|
|
20
24
|
const { frontmatter, body } = extractFrontmatter(raw);
|
|
@@ -37,7 +41,10 @@ const parsePrompt = (raw) => {
|
|
|
37
41
|
/** All available prompts, keyed by name. */
|
|
38
42
|
export const prompts = (() => {
|
|
39
43
|
const map = new Map();
|
|
40
|
-
for (const
|
|
44
|
+
for (const name of PROMPT_NAMES) {
|
|
45
|
+
const raw = readPromptFile(name);
|
|
46
|
+
if (!raw)
|
|
47
|
+
continue;
|
|
41
48
|
const prompt = parsePrompt(raw);
|
|
42
49
|
map.set(prompt.name, prompt);
|
|
43
50
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiho/xdocs",
|
|
3
3
|
"description": "Structured documentation system for codebases. Helps AI make sense of projects.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./library/guiho-xdocs.js",
|
|
7
7
|
"types": "./library/guiho-xdocs.d.ts",
|