@chronova/wiki-agent 1.2.2 → 1.3.1

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 CHANGED
@@ -109,21 +109,20 @@ Environment variables take priority over config files.
109
109
 
110
110
  ## GitHub Actions
111
111
 
112
- Running `wiki --init` automatically creates `.github/workflows/update-wiki.yml` in your repo. The workflow publishes generated pages to your repository's **GitHub Wiki tab**, not to the main repo's file tree:
112
+ Running `wiki --init --wiki` automatically creates `.github/workflows/update-wiki.yml` in your repo. With `--wiki`, the workflow publishes generated pages to your repository's **GitHub Wiki tab**; without `--wiki` it only stages `.wiki/` and opens a staging PR.
113
113
 
114
114
  1. Generates a GitHub App token if `APP_CLIENT_ID` and `APP_PRIVATE_KEY` secrets are set (falls back to `GITHUB_TOKEN`)
115
115
  2. Checks out your repo, clones and builds wiki-agent from `nx-solutions-ug/wiki-agent`
116
- 3. Runs `wiki --update --print` with your Ollama Cloud credentials, staging pages under `.wiki/`
116
+ 3. Runs `wiki --update --print --verbose` (with `--wiki` if the flag was passed at `--init` time), staging pages under `.wiki/`
117
117
  4. Probes the wiki remote (`<repo>.wiki.git`) with `git ls-remote` to detect whether the wiki has been initialized
118
- 5. If there are content changes and the wiki is initialized: clones `<repo>.wiki.git`, syncs the `.wiki/` content (excluding `config.json`, `.last-update-report.md`, `.last-updated.json`) via `rsync`, commits on a `wiki/update-<timestamp>` branch, and pushes
119
- 6. Opens a pull request against the wiki repo (`--repo <owner>/<repo>.wiki`, base `master`) with `.wiki/.last-update-report.md` as the body a human merges to make updates live
120
- 7. Always opens a `docs: wiki staging snapshot` pull request against the main repo with the `.wiki/` changes, so the staged content stays auditable
118
+ 5. If there are content changes and the wiki is initialized: clones `<repo>.wiki.git`, syncs the staged `.wiki/` content (excluding `config.json` and the run metadata) via `rsync`, commits, and **pushes directly to `master`** — the wiki goes live immediately (no PR, no review gate)
119
+ 6. Always opens a `docs: wiki staging snapshot` pull request against the main repo with the `.wiki/` changes, so the staged content stays auditable
121
120
 
122
121
  ### Bootstrap the wiki first
123
122
 
124
123
  GitHub wikis must be initialized once through the UI before they can be pushed to programmatically. Open the **Wiki** tab in your repository, create the first page (any content), then run the workflow. Until then the publish step is skipped with a warning; the staging PR still opens so you can inspect the generated content.
125
124
 
126
- The full workflow is written to `.github/workflows/update-wiki.yml` by `wiki --init`. See that file (or the template in [`src/agent.ts`](src/agent.ts) `createWorkflowFile`) for the authoritative, current definition. The steps in brief: generate token → checkout → build wiki-agent → run `--update --print` → probe wiki remote → if there are content changes and the wiki is initialized, clone `<repo>.wiki.git`, `rsync` the staged `.wiki/` content (excluding `config.json` and the run metadata), commit on `wiki/update-<timestamp>`, push → open a PR against the wiki repo (base `master`) → open a `docs: wiki staging snapshot` PR against the main repo.
125
+ The full workflow is written to `.github/workflows/update-wiki.yml` by `wiki --init`. See that file (or the template in [`src/agent.ts`](src/agent.ts) `createWorkflowFile`) for the authoritative, current definition.
127
126
 
128
127
  ### Required secrets
129
128
 
package/dist/agent.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface RunOptions {
21
21
  gitSummary?: string;
22
22
  maxIterations?: number;
23
23
  stream?: boolean;
24
+ wikiPublish?: boolean;
24
25
  onEvent?: (event: AgentEvent) => void;
25
26
  }
26
27
  export declare function runAgent(client: Ollama, options: RunOptions): Promise<void>;
package/dist/agent.js CHANGED
@@ -43,7 +43,7 @@ function normalizeToolCallArgs(args) {
43
43
  return {};
44
44
  }
45
45
  export async function runAgent(client, options) {
46
- const { command, projectRoot, model, gitSummary, maxIterations, stream = false, onEvent = () => { }, } = options;
46
+ const { command, projectRoot, model, gitSummary, maxIterations, stream = false, wikiPublish = false, onEvent = () => { }, } = options;
47
47
  const maxIter = maxIterations ?? resolveMaxIterations();
48
48
  const tools = createTools(projectRoot);
49
49
  const systemPrompt = await createSystemPrompt(projectRoot);
@@ -156,8 +156,8 @@ export async function runAgent(client, options) {
156
156
  });
157
157
  }
158
158
  }
159
- await createWorkflowFile(projectRoot);
160
- onEvent({ type: "tool", name: "create_workflow", result: "Created .github/workflows/update-wiki.yml" });
159
+ await createWorkflowFile(projectRoot, wikiPublish);
160
+ onEvent({ type: "tool", name: "create_workflow", result: wikiPublish ? "Created .github/workflows/update-wiki.yml (with wiki publish)" : "Created .github/workflows/update-wiki.yml" });
161
161
  if (changedFiles.length === 0) {
162
162
  onEvent({ type: "done", summary: "Wiki is already current. No files changed." });
163
163
  return;
@@ -172,10 +172,11 @@ export async function runAgent(client, options) {
172
172
  * Creates a GitHub Actions workflow file in the target repo that checks out
173
173
  * the wiki-agent source, builds it, and runs --update --print on a schedule.
174
174
  */
175
- async function createWorkflowFile(projectRoot) {
175
+ async function createWorkflowFile(projectRoot, wikiPublish) {
176
176
  const workflowsDir = path.join(projectRoot, ".github", "workflows");
177
177
  const workflowPath = path.join(workflowsDir, "update-wiki.yml");
178
178
  await mkdir(workflowsDir, { recursive: true });
179
+ const runFlags = wikiPublish ? "--update --print --verbose --wiki" : "--update --print --verbose";
179
180
  const workflow = [
180
181
  "name: Wiki Update",
181
182
  "",
@@ -221,7 +222,7 @@ async function createWorkflowFile(projectRoot) {
221
222
  " npx tsc -p tsconfig.json",
222
223
  "",
223
224
  " - name: Run Wiki Agent",
224
- " run: node /tmp/wiki-agent/dist/cli.js --update --print --verbose",
225
+ ` run: node /tmp/wiki-agent/dist/cli.js ${runFlags}`,
225
226
  " env:",
226
227
  " WIKI_OLLAMA_MODE: cloud",
227
228
  ' WIKI_OLLAMA_API_KEY: ${{ secrets.WIKI_OLLAMA_API_KEY }}',
@@ -231,23 +232,6 @@ async function createWorkflowFile(projectRoot) {
231
232
  " id: timestamp",
232
233
  " run: echo \"timestamp=$(date +%s)\" >> $GITHUB_OUTPUT",
233
234
  "",
234
- " - name: Repository coordinates",
235
- " id: coords",
236
- " run: echo \"owner_repo=${GITHUB_REPOSITORY}\" >> $GITHUB_OUTPUT",
237
- "",
238
- " - name: Detect wiki initialization",
239
- " id: wiki-init",
240
- " env:",
241
- " TOKEN: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}",
242
- " run: |",
243
- " REMOTE=\"https://x-access-token:${TOKEN}@github.com/${{ steps.coords.outputs.owner_repo }}.wiki.git\"",
244
- " if git ls-remote --exit-code \"$REMOTE\" HEAD >/dev/null 2>&1; then",
245
- " echo \"initialized=true\" >> $GITHUB_OUTPUT",
246
- " else",
247
- " echo \"initialized=false\" >> $GITHUB_OUTPUT",
248
- " echo \"::warning::Wiki is not initialized. Create the first page in the GitHub UI (Wiki tab -> New Page), then rerun. Staging PR will still be opened.\" >> $GITHUB_OUTPUT",
249
- " fi",
250
- "",
251
235
  " - name: Check for changes",
252
236
  " id: report",
253
237
  " run: |",
@@ -264,61 +248,12 @@ async function createWorkflowFile(projectRoot) {
264
248
  " echo \"has_changes=false\" >> $GITHUB_OUTPUT",
265
249
  " fi",
266
250
  "",
267
- " - name: Publish to wiki repo",
268
- " id: publish",
269
- " if: steps.report.outputs.has_changes == 'true' && steps.wiki-init.outputs.initialized == 'true'",
270
- " env:",
271
- " TOKEN: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}",
272
- " run: |",
273
- " BRANCH=\"wiki/update-${{ steps.timestamp.outputs.timestamp }}\"",
274
- " WIKI_URL=\"https://x-access-token:${TOKEN}@github.com/${{ steps.coords.outputs.owner_repo }}.wiki.git\"",
275
- " rm -rf /tmp/wiki",
276
- " git clone \"$WIKI_URL\" /tmp/wiki",
277
- " cd /tmp/wiki",
278
- " git checkout -b \"$BRANCH\"",
279
- " # --exclude='.git' protects the wiki clone's .git directory from --delete.",
280
- " rsync -a --delete \\",
281
- " --exclude='.git' \\",
282
- " --exclude='.last-update-report.md' \\",
283
- " --exclude='.last-updated.json' \\",
284
- " --exclude='config.json' \\",
285
- " \"$GITHUB_WORKSPACE/.wiki/\" ./",
286
- " git add -A",
287
- " if ! git diff --cached --quiet; then",
288
- " git -c user.name='wiki-agent[bot]' -c user.email='bot@wiki-agent' \\",
289
- " commit -m \"docs: update wiki\"",
290
- " if ! git push origin \"$BRANCH\" 2>&1 | tee /tmp/wiki-push.log; then",
291
- " echo \"::error::Failed to push to the wiki repo. Ensure the GitHub App has contents:write on the repository (which covers the wiki), or set a WIKI_PUSH_TOKEN secret with repo scope.\"",
292
- " exit 1",
293
- " fi",
294
- " echo \"branch=$BRANCH\" >> $GITHUB_OUTPUT",
295
- " else",
296
- " echo \"::warning::No net wiki content changes after sync; skipping wiki push.\"",
297
- " echo \"branch=\" >> $GITHUB_OUTPUT",
298
- " fi",
299
- "",
300
- " - name: Open wiki update pull request",
301
- " if: steps.report.outputs.has_changes == 'true' && steps.wiki-init.outputs.initialized == 'true' && steps.publish.outputs.branch != ''",
302
- " env:",
303
- " GH_TOKEN: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}",
304
- " run: |",
305
- " gh pr create --repo \"${{ steps.coords.outputs.owner_repo }}.wiki\" \\",
306
- " --head \"wiki/update-${{ steps.timestamp.outputs.timestamp }}\" \\",
307
- " --base master \\",
308
- " --title \"docs: update wiki\" \\",
309
- " --body-file .wiki/.last-update-report.md",
310
- "",
311
- " - name: Create wiki staging snapshot pull request",
312
- " uses: peter-evans/create-pull-request@v8",
313
- " if: steps.report.outputs.has_changes == 'true'",
314
- " with:",
315
- " token: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}",
316
- " branch: wiki/staging-${{ steps.timestamp.outputs.timestamp }}",
317
- " add-paths: .wiki",
318
- ' title: "docs: wiki staging snapshot"',
319
- ' body: ${{ steps.report.outputs.body }}',
320
- ].join("\n");
321
- await writeFile(workflowPath, workflow, "utf8");
251
+ ];
252
+ if (wikiPublish) {
253
+ workflow.push(" - name: Repository coordinates", " id: coords", " run: echo \"owner_repo=${GITHUB_REPOSITORY}\" >> $GITHUB_OUTPUT", "", " - name: Detect wiki initialization", " id: wiki-init", " env:", " TOKEN: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}", " run: |", " REMOTE=\"https://x-access-token:${TOKEN}@github.com/${{ steps.coords.outputs.owner_repo }}.wiki.git\"", " if git ls-remote --exit-code \"$REMOTE\" HEAD >/dev/null 2>&1; then", " echo \"initialized=true\" >> $GITHUB_OUTPUT", " else", " echo \"initialized=false\" >> $GITHUB_OUTPUT", " echo \"::warning::Wiki is not initialized. Create the first page in the GitHub UI (Wiki tab -> New Page), then rerun. Staging PR will still be opened.\" >> $GITHUB_OUTPUT", " fi", "", " - name: Publish to wiki repo", " id: publish", " if: steps.report.outputs.has_changes == 'true' && steps.wiki-init.outputs.initialized == 'true'", " env:", " TOKEN: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}", " run: |", " WIKI_URL=\"https://x-access-token:${TOKEN}@github.com/${{ steps.coords.outputs.owner_repo }}.wiki.git\"", " rm -rf /tmp/wiki", " git clone \"$WIKI_URL\" /tmp/wiki", " cd /tmp/wiki", " # --exclude='.git' protects the wiki clone's .git directory from --delete.", " rsync -a --delete \\", " --exclude='.git' \\", " --exclude='.last-update-report.md' \\", " --exclude='.last-updated.json' \\", " --exclude='config.json' \\", " \"$GITHUB_WORKSPACE/.wiki/\" ./", " git add -A", " if ! git diff --cached --quiet; then", " git -c user.name='wiki-agent[bot]' -c user.email='bot@wiki-agent' \\", " commit -m \"docs: update wiki\"", " if ! git push origin master 2>&1 | tee /tmp/wiki-push.log; then", " echo \"::error::Failed to push to the wiki repo. Ensure the GitHub App has contents:write on the repository (which covers the wiki), or set a WIKI_PUSH_TOKEN secret with repo scope.\"", " exit 1", " fi", " echo \"published=true\" >> $GITHUB_OUTPUT", " else", " echo \"::warning::No net wiki content changes after sync; skipping wiki push.\"", " echo \"published=false\" >> $GITHUB_OUTPUT", " fi");
254
+ }
255
+ workflow.push(" - name: Create wiki staging snapshot pull request", " uses: peter-evans/create-pull-request@v8", " if: steps.report.outputs.has_changes == 'true'", " with:", " token: ${{ secrets.WIKI_PUSH_TOKEN || steps.token.outputs.token || secrets.GITHUB_TOKEN }}", " branch: wiki/staging-${{ steps.timestamp.outputs.timestamp }}", " add-paths: .wiki", ' title: "docs: wiki staging snapshot"', ' body: ${{ steps.report.outputs.body }}');
256
+ await writeFile(workflowPath, workflow.join("\n") + "\n", "utf8");
322
257
  }
323
258
  /**
324
259
  * Generates a markdown report of what changed during this run.
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { getHelpText } from "./prompt.js";
9
9
  import { App } from "./tui/App.js";
10
10
  const execAsync = promisify(exec);
11
11
  function parseArgs(argv) {
12
- const args = { command: null, print: false, verbose: false, help: false };
12
+ const args = { command: null, print: false, verbose: false, wiki: false, help: false };
13
13
  for (let i = 2; i < argv.length; i++) {
14
14
  const arg = argv[i];
15
15
  switch (arg) {
@@ -26,6 +26,9 @@ function parseArgs(argv) {
26
26
  case "-v":
27
27
  args.verbose = true;
28
28
  break;
29
+ case "--wiki":
30
+ args.wiki = true;
31
+ break;
29
32
  case "--model":
30
33
  args.model = argv[++i];
31
34
  break;
@@ -49,7 +52,7 @@ async function getGitSummary(cwd) {
49
52
  return "(git not available or not a git repository)";
50
53
  }
51
54
  }
52
- async function runHeadless(command, cwd, model, verbose) {
55
+ async function runHeadless(command, cwd, model, verbose, wiki) {
53
56
  const config = await resolveConfig(cwd, model);
54
57
  const client = createOllamaClient(config);
55
58
  const gitSummary = await getGitSummary(cwd);
@@ -58,6 +61,7 @@ async function runHeadless(command, cwd, model, verbose) {
58
61
  projectRoot: cwd,
59
62
  model: config.model,
60
63
  gitSummary,
64
+ wikiPublish: wiki,
61
65
  stream: false,
62
66
  onEvent: (event) => {
63
67
  switch (event.type) {
@@ -95,7 +99,7 @@ async function main() {
95
99
  process.exit(1);
96
100
  }
97
101
  if (args.print) {
98
- await runHeadless(command, cwd, config.model, args.verbose);
102
+ await runHeadless(command, cwd, config.model, args.verbose, args.wiki);
99
103
  }
100
104
  else {
101
105
  const { waitUntilExit } = inkRender(React.createElement(App, {
@@ -103,6 +107,7 @@ async function main() {
103
107
  cwd,
104
108
  config,
105
109
  verbose: args.verbose,
110
+ wiki: args.wiki,
106
111
  }));
107
112
  await waitUntilExit();
108
113
  }
package/dist/prompt.js CHANGED
@@ -121,6 +121,7 @@ Usage
121
121
  wiki --update --print Headless update (non-interactive)
122
122
  wiki --init --print --model <id> Specify model
123
123
  wiki --update --print --verbose Headless update with full tool logs
124
+ wiki --update --print --wiki Update and publish to the GitHub Wiki tab
124
125
  wiki --help Show this help
125
126
 
126
127
  Options
@@ -129,6 +130,7 @@ Options
129
130
  --print Run headless (non-interactive, output to stdout)
130
131
  --verbose, -v Show full tool call results (default: assistant prose only)
131
132
  --model <id> Override the model ID
133
+ --wiki Publish to the GitHub Wiki tab (generates wiki-publish workflow)
132
134
  --help, -h Show help
133
135
 
134
136
  Environment variables
package/dist/tui/App.d.ts CHANGED
@@ -5,6 +5,7 @@ interface AppProps {
5
5
  cwd: string;
6
6
  config: ResolvedConfig;
7
7
  verbose: boolean;
8
+ wiki: boolean;
8
9
  }
9
- export declare function App({ command, cwd, config, verbose }: AppProps): React.ReactElement;
10
+ export declare function App({ command, cwd, config, verbose, wiki }: AppProps): React.ReactElement;
10
11
  export {};
package/dist/tui/App.js CHANGED
@@ -2,7 +2,7 @@ import React, { useState, useCallback } from "react";
2
2
  import { Box, Text, useApp, useInput } from "ink";
3
3
  import { CredentialsSetup } from "./CredentialsSetup.js";
4
4
  import { RunView } from "./RunView.js";
5
- export function App({ command, cwd, config, verbose }) {
5
+ export function App({ command, cwd, config, verbose, wiki }) {
6
6
  const [needsSetup, setNeedsSetup] = useState(config.mode === "cloud" && !config.apiKey);
7
7
  const [resolvedConfig, setResolvedConfig] = useState(config);
8
8
  const { exit } = useApp();
@@ -26,6 +26,7 @@ export function App({ command, cwd, config, verbose }) {
26
26
  cwd,
27
27
  config: resolvedConfig,
28
28
  verbose,
29
+ wiki,
29
30
  onExit: exit,
30
31
  }));
31
32
  }
@@ -6,7 +6,8 @@ interface RunViewProps {
6
6
  cwd: string;
7
7
  config: ResolvedConfig;
8
8
  verbose: boolean;
9
+ wiki: boolean;
9
10
  onExit: () => void;
10
11
  }
11
- export declare function RunView({ command, cwd, config, verbose, onExit, }: RunViewProps): React.ReactElement;
12
+ export declare function RunView({ command, cwd, config, verbose, wiki, onExit, }: RunViewProps): React.ReactElement;
12
13
  export {};
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from "react";
2
2
  import { Box, Text, useApp } from "ink";
3
3
  import { runAgent } from "../agent.js";
4
4
  import { createOllamaClient } from "../config.js";
5
- export function RunView({ command, cwd, config, verbose, onExit, }) {
5
+ export function RunView({ command, cwd, config, verbose, wiki, onExit, }) {
6
6
  const [events, setEvents] = useState([]);
7
7
  const [running, setRunning] = useState(true);
8
8
  const [error, setError] = useState(null);
@@ -15,6 +15,7 @@ export function RunView({ command, cwd, config, verbose, onExit, }) {
15
15
  command,
16
16
  projectRoot: cwd,
17
17
  model: config.model,
18
+ wikiPublish: wiki,
18
19
  stream: true,
19
20
  onEvent: (event) => {
20
21
  // Merge consecutive assistant chunks into one line so streaming
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chronova/wiki-agent",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "Standalone Ollama-only documentation agent",
5
5
  "type": "module",
6
6
  "bin": {