@skrr-ai/cli 0.1.118 → 0.1.120
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/dist/base-command.d.ts +32 -0
- package/dist/base-command.js +113 -5
- package/dist/commands/commands.js +11 -0
- package/dist/commands/commitments/action-proposal.d.ts +13 -0
- package/dist/commands/commitments/action-proposal.js +39 -0
- package/dist/commands/commitments/action-proposals/decide.js +8 -1
- package/dist/commands/commitments/action-proposals/execute.js +11 -1
- package/dist/commands/commitments/create.js +2 -2
- package/dist/commands/commitments/doctor.d.ts +8 -0
- package/dist/commands/commitments/doctor.js +22 -0
- package/dist/commands/commitments/execute-remediation.js +12 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/pack/bind.d.ts +18 -1
- package/dist/commands/commitments/pack/bind.js +66 -8
- package/dist/commands/commitments/pack/plan.d.ts +4 -1
- package/dist/commands/commitments/pack/plan.js +30 -2
- package/dist/commands/commitments/update.js +8 -2
- package/dist/commands/completion/index.js +1 -1
- package/dist/commands/completion/values.js +1 -1
- package/dist/commands/computer-use/audio.d.ts +1 -0
- package/dist/commands/computer-use/audio.js +1 -0
- package/dist/commands/computer-use/browser.d.ts +1 -0
- package/dist/commands/computer-use/browser.js +1 -0
- package/dist/commands/computer-use/disable.d.ts +1 -0
- package/dist/commands/computer-use/disable.js +1 -0
- package/dist/commands/computer-use/enable.d.ts +1 -0
- package/dist/commands/computer-use/enable.js +1 -0
- package/dist/commands/computer-use/index.d.ts +1 -0
- package/dist/commands/computer-use/index.js +1 -0
- package/dist/commands/computer-use/install.d.ts +1 -0
- package/dist/commands/computer-use/install.js +1 -0
- package/dist/commands/computer-use/recover.d.ts +1 -0
- package/dist/commands/computer-use/recover.js +1 -0
- package/dist/commands/computer-use/status.d.ts +1 -0
- package/dist/commands/computer-use/status.js +1 -0
- package/dist/commands/computer-use/stop.d.ts +1 -0
- package/dist/commands/computer-use/stop.js +1 -0
- package/dist/commands/context.js +16 -11
- package/dist/commands/convos/recovery.js +1 -1
- package/dist/commands/daemon/diagnostics.d.ts +9 -0
- package/dist/commands/daemon/diagnostics.js +53 -0
- package/dist/commands/daemon/index.js +2 -0
- package/dist/commands/daemon/maintenance/attest.d.ts +15 -0
- package/dist/commands/daemon/maintenance/attest.js +52 -0
- package/dist/commands/daemon/maintenance/hold.d.ts +17 -0
- package/dist/commands/daemon/maintenance/hold.js +70 -0
- package/dist/commands/daemon/maintenance/index.d.ts +12 -0
- package/dist/commands/daemon/maintenance/index.js +30 -0
- package/dist/commands/daemon/maintenance/resume.d.ts +13 -0
- package/dist/commands/daemon/maintenance/resume.js +36 -0
- package/dist/commands/daemon/maintenance/status.d.ts +13 -0
- package/dist/commands/daemon/maintenance/status.js +36 -0
- package/dist/commands/doctor.d.ts +4 -1
- package/dist/commands/doctor.js +50 -6
- package/dist/commands/followups/plans/cancel-batch.js +6 -3
- package/dist/commands/followups/plans/capacity.js +7 -3
- package/dist/commands/followups/plans/observability.js +11 -3
- package/dist/commands/followups/plans/preferences/set.js +26 -8
- package/dist/commands/followups/plans/preferences.js +1 -1
- package/dist/commands/followups/plans/show.js +1 -1
- package/dist/commands/goals/key-results/assess.d.ts +36 -0
- package/dist/commands/goals/key-results/assess.js +110 -0
- package/dist/commands/goals/key-results/history.d.ts +30 -0
- package/dist/commands/goals/key-results/history.js +104 -0
- package/dist/commands/goals/key-results/list.d.ts +5 -4
- package/dist/commands/goals/key-results/list.js +12 -6
- package/dist/commands/goals/key-results/show.d.ts +4 -2
- package/dist/commands/goals/key-results/show.js +25 -4
- package/dist/commands/goals/key-results/update.d.ts +4 -0
- package/dist/commands/goals/key-results/update.js +18 -24
- package/dist/commands/goals/plan-now.js +12 -1
- package/dist/commands/goals/planner-compare.d.ts +30 -0
- package/dist/commands/goals/planner-compare.js +136 -0
- package/dist/commands/machines/dedicated/service/exec.d.ts +3 -0
- package/dist/commands/machines/dedicated/service/exec.js +70 -11
- package/dist/commands/machines/hosted/destroy.d.ts +1 -0
- package/dist/commands/machines/hosted/destroy.js +11 -1
- package/dist/commands/machines/hosted/exec.d.ts +1 -0
- package/dist/commands/machines/hosted/exec.js +12 -1
- package/dist/commands/machines/hosted/index.js +1 -0
- package/dist/commands/machines/hosted/operation.d.ts +14 -0
- package/dist/commands/machines/hosted/operation.js +51 -0
- package/dist/commands/machines/hosted/pull.js +1 -1
- package/dist/commands/machines/hosted/start.js +6 -2
- package/dist/commands/memory/versions/list.d.ts +2 -0
- package/dist/commands/memory/versions/list.js +3 -2
- package/dist/commands/memory/versions/show.d.ts +2 -0
- package/dist/commands/memory/versions/show.js +3 -2
- package/dist/commands/spaces/auto-executor/compare.d.ts +18 -0
- package/dist/commands/spaces/auto-executor/compare.js +139 -0
- package/dist/commands/spaces/auto-executor/runs.d.ts +3 -0
- package/dist/commands/spaces/auto-executor/runs.js +13 -1
- package/dist/commands/spaces/charter/create-from-description.d.ts +21 -0
- package/dist/commands/spaces/charter/create-from-description.js +77 -0
- package/dist/commands/spaces/charter/show.d.ts +22 -0
- package/dist/commands/spaces/charter/show.js +61 -0
- package/dist/commands/spaces/heartbeats/list.d.ts +1 -16
- package/dist/commands/spaces/heartbeats/list.js +13 -0
- package/dist/commands/spaces/install-template.js +3 -0
- package/dist/commands/spaces/loops/migrate.d.ts +32 -0
- package/dist/commands/spaces/loops/migrate.js +103 -0
- package/dist/commands/spaces/loops/release.d.ts +14 -0
- package/dist/commands/spaces/loops/release.js +59 -0
- package/dist/commands/spaces/notebook.d.ts +25 -0
- package/dist/commands/spaces/notebook.js +75 -0
- package/dist/commands/spaces/proposals/discard.d.ts +17 -0
- package/dist/commands/spaces/proposals/discard.js +17 -0
- package/dist/commands/spaces/proposals/keep.d.ts +17 -0
- package/dist/commands/spaces/proposals/keep.js +17 -0
- package/dist/commands/spaces/proposals/list.d.ts +24 -0
- package/dist/commands/spaces/proposals/list.js +89 -0
- package/dist/commands/spaces/skills/propose.d.ts +29 -0
- package/dist/commands/spaces/skills/propose.js +82 -0
- package/dist/commands/spaces/templates/fork.js +3 -0
- package/dist/commands/spaces/triggers/show.js +6 -0
- package/dist/commands/spaces/workflows/retry.d.ts +1 -0
- package/dist/commands/spaces/workflows/retry.js +8 -1
- package/dist/commands/spaces/workflows/triggers/create.js +3 -2
- package/dist/commands/spaces/workflows/triggers/fire.js +4 -0
- package/dist/commands/spaces/workflows/triggers/update.js +2 -1
- package/dist/commands/spaces/write-policy/set.d.ts +22 -0
- package/dist/commands/spaces/write-policy/set.js +82 -0
- package/dist/commands/spaces/write-policy/show.d.ts +19 -0
- package/dist/commands/spaces/write-policy/show.js +49 -0
- package/dist/commands/store/artifacts/receipt.d.ts +14 -0
- package/dist/commands/store/artifacts/receipt.js +34 -0
- package/dist/commands/store/artifacts/release.d.ts +2 -0
- package/dist/commands/store/artifacts/release.js +11 -0
- package/dist/commands/store/governance/publish-release.d.ts +2 -0
- package/dist/commands/store/governance/publish-release.js +30 -1
- package/dist/commands/store/governance/release-receipt.d.ts +12 -0
- package/dist/commands/store/governance/release-receipt.js +32 -0
- package/dist/commands/tasks/approvals/list.d.ts +11 -5
- package/dist/commands/tasks/approvals/list.js +13 -6
- package/dist/commands/tasks/attachments/facts.d.ts +12 -0
- package/dist/commands/tasks/attachments/facts.js +29 -0
- package/dist/commands/tasks/attachments/upload.d.ts +1 -0
- package/dist/commands/tasks/attachments/upload.js +16 -0
- package/dist/commands/tasks/bulk-update.js +35 -1
- package/dist/commands/tasks/context.d.ts +15 -0
- package/dist/commands/tasks/context.js +69 -0
- package/dist/commands/tasks/copy.d.ts +18 -0
- package/dist/commands/tasks/copy.js +85 -0
- package/dist/commands/tasks/create-tree.js +97 -23
- package/dist/commands/tasks/create.js +9 -1
- package/dist/commands/tasks/deliverable/add.js +20 -10
- package/dist/commands/tasks/move.js +8 -1
- package/dist/commands/tasks/operations/show.d.ts +16 -0
- package/dist/commands/tasks/operations/show.js +98 -0
- package/dist/commands/tasks/operations/wait.d.ts +22 -0
- package/dist/commands/tasks/operations/wait.js +114 -0
- package/dist/commands/tasks/preflight.d.ts +1 -0
- package/dist/commands/tasks/preflight.js +11 -1
- package/dist/commands/tasks/rearm-recurrence.js +4 -0
- package/dist/commands/tasks/result/show.js +22 -0
- package/dist/commands/tasks/result/submit.d.ts +1 -0
- package/dist/commands/tasks/result/submit.js +3 -0
- package/dist/commands/tasks/retry-receipt.d.ts +15 -0
- package/dist/commands/tasks/retry-receipt.js +89 -0
- package/dist/commands/tasks/retry-review.d.ts +16 -0
- package/dist/commands/tasks/retry-review.js +66 -0
- package/dist/commands/tasks/retry.d.ts +4 -8
- package/dist/commands/tasks/retry.js +34 -68
- package/dist/commands/tasks/runs.d.ts +21 -0
- package/dist/commands/tasks/runs.js +95 -0
- package/dist/commands/tasks/show.d.ts +2 -0
- package/dist/commands/tasks/show.js +15 -1
- package/dist/commands/tasks/start-receipt.d.ts +15 -0
- package/dist/commands/tasks/start-receipt.js +95 -0
- package/dist/commands/tasks/start.d.ts +4 -0
- package/dist/commands/tasks/start.js +49 -3
- package/dist/commands/tasks/update.js +3 -0
- package/dist/commands/tasks/upsert.js +17 -3
- package/dist/commands/tasks/watch.d.ts +3 -0
- package/dist/commands/tasks/watch.js +85 -20
- package/dist/commands/wiki/history.d.ts +33 -0
- package/dist/commands/wiki/history.js +134 -0
- package/dist/commands/wiki/ls.d.ts +2 -0
- package/dist/commands/wiki/ls.js +8 -0
- package/dist/commands/wiki/update.d.ts +3 -1
- package/dist/commands/wiki/update.js +24 -2
- package/dist/commands/wiki/write.d.ts +22 -0
- package/dist/commands/wiki/write.js +144 -6
- package/dist/generated/agent-guides.json +81 -81
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-guides.d.ts +9 -0
- package/dist/lib/agent-guides.js +23 -1
- package/dist/lib/agentic-stream.d.ts +5 -0
- package/dist/lib/agentic-stream.js +122 -3
- package/dist/lib/api-fetch.d.ts +4 -0
- package/dist/lib/api-fetch.js +25 -7
- package/dist/lib/auth-diagnostics.d.ts +39 -0
- package/dist/lib/auth-diagnostics.js +71 -0
- package/dist/lib/cli-client-identity.d.ts +6 -0
- package/dist/lib/cli-client-identity.js +16 -0
- package/dist/lib/cli-installation-diagnostics.d.ts +52 -0
- package/dist/lib/cli-installation-diagnostics.js +254 -0
- package/dist/lib/command-hygiene.d.ts +45 -0
- package/dist/lib/command-hygiene.js +413 -0
- package/dist/lib/commitments.d.ts +64 -3
- package/dist/lib/commitments.js +34 -6
- package/dist/lib/completion-index.d.ts +16 -4
- package/dist/lib/completion-index.js +50 -14
- package/dist/lib/config.js +7 -1
- package/dist/lib/daemon-maintenance-command.d.ts +22 -0
- package/dist/lib/daemon-maintenance-command.js +39 -0
- package/dist/lib/daemon-maintenance.d.ts +275 -0
- package/dist/lib/daemon-maintenance.js +1035 -0
- package/dist/lib/dedicated-service.d.ts +3 -2
- package/dist/lib/dedicated-service.js +11 -3
- package/dist/lib/governed-store.d.ts +8 -0
- package/dist/lib/governed-store.js +5 -0
- package/dist/lib/hosted-machines.d.ts +33 -2
- package/dist/lib/hosted-machines.js +19 -1
- package/dist/lib/json-output.d.ts +1 -1
- package/dist/lib/machines.d.ts +9 -1
- package/dist/lib/machines.js +15 -1
- package/dist/lib/memory-history-session.d.ts +14 -0
- package/dist/lib/memory-history-session.js +60 -0
- package/dist/lib/node-adapter.js +13 -0
- package/dist/lib/record-output.d.ts +22 -0
- package/dist/lib/record-output.js +78 -0
- package/dist/lib/roles.d.ts +3 -3
- package/dist/lib/scoped-memory-command.d.ts +24 -0
- package/dist/lib/scoped-memory-command.js +87 -5
- package/dist/lib/space-charter.d.ts +49 -0
- package/dist/lib/space-charter.js +78 -0
- package/dist/lib/space-loop-migration.d.ts +18 -0
- package/dist/lib/space-loop-migration.js +128 -0
- package/dist/lib/space-notebook.d.ts +22 -0
- package/dist/lib/space-notebook.js +140 -0
- package/dist/lib/space-proposal-decision-command.d.ts +36 -0
- package/dist/lib/space-proposal-decision-command.js +108 -0
- package/dist/lib/space-proposals.d.ts +44 -0
- package/dist/lib/space-proposals.js +186 -0
- package/dist/lib/space-templates.d.ts +8 -0
- package/dist/lib/space-templates.js +17 -0
- package/dist/lib/space-write-policy.d.ts +24 -0
- package/dist/lib/space-write-policy.js +103 -0
- package/dist/lib/task-agent-context-capabilities.d.ts +10 -0
- package/dist/lib/task-agent-context-capabilities.js +22 -0
- package/dist/lib/task-agent-context-compatibility.d.ts +9 -0
- package/dist/lib/task-agent-context-compatibility.js +30 -0
- package/dist/lib/task-asset-upload.d.ts +22 -0
- package/dist/lib/task-asset-upload.js +257 -29
- package/dist/lib/task-batch.d.ts +15 -1
- package/dist/lib/task-batch.js +35 -2
- package/dist/lib/task-operation-watch.d.ts +66 -0
- package/dist/lib/task-operation-watch.js +159 -0
- package/dist/lib/task-resolver.d.ts +1 -1
- package/dist/lib/task-resolver.js +4 -3
- package/dist/lib/task-runtime-headers.js +13 -3
- package/dist/lib/task-work.d.ts +1 -1
- package/dist/lib/task-work.js +35 -1
- package/dist/lib/task-write-attribution.d.ts +14 -0
- package/dist/lib/task-write-attribution.js +35 -2
- package/dist/lib/triggers.d.ts +11 -0
- package/dist/lib/triggers.js +7 -0
- package/dist/lib/wiki-update.d.ts +1 -0
- package/dist/lib/wiki-update.js +10 -1
- package/dist/lib/wiki.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerWire.js +31 -15
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonToolApproval.js +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +13 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.d.ts +370 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +315 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.d.ts +178 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/maintenanceReportWire.js +262 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +51 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +106 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.d.ts +9 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerWire.js +32 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonToolApproval.js +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +33 -14
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.d.ts +370 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +404 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.d.ts +178 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/maintenanceReportWire.js +342 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +51 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +138 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +20 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +27085 -20250
- package/oclif.manifest.json +10570 -7247
- package/package.json +20 -2
|
@@ -4,10 +4,12 @@ exports.isWikiPageNotFound = isWikiPageNotFound;
|
|
|
4
4
|
exports.conflictingPageId = conflictingPageId;
|
|
5
5
|
exports.slugifyLikeServer = slugifyLikeServer;
|
|
6
6
|
exports.createdSlugCollided = createdSlugCollided;
|
|
7
|
+
exports.kindIgnoredWarning = kindIgnoredWarning;
|
|
7
8
|
const core_1 = require("@oclif/core");
|
|
8
9
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
9
10
|
const base_command_1 = require("../../base-command");
|
|
10
11
|
const http_error_1 = require("../../lib/http-error");
|
|
12
|
+
const space_charter_1 = require("../../lib/space-charter");
|
|
11
13
|
const web_url_1 = require("../../lib/web-url");
|
|
12
14
|
const wiki_1 = require("../../lib/wiki");
|
|
13
15
|
/**
|
|
@@ -90,6 +92,27 @@ function createdSlugCollided(requestedSlug, createdSlug) {
|
|
|
90
92
|
// fallback, an 8-char uuid head.
|
|
91
93
|
return /^\d+$/.test(suffix) || /^[0-9a-f]{8}$/.test(suffix);
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* The warning for `--kind` on a write that landed in a page that already
|
|
97
|
+
* existed, or `null` when there is nothing to say.
|
|
98
|
+
*
|
|
99
|
+
* `--kind`, like `--title`, describes a page this command CREATES: `write` owns
|
|
100
|
+
* the body, `update` owns metadata. A write into an existing page of another
|
|
101
|
+
* kind therefore changes the body and not the kind, and saying so is the
|
|
102
|
+
* difference between that and a silent no-op. A page an older server returns
|
|
103
|
+
* without a kind reads as `doc`.
|
|
104
|
+
*/
|
|
105
|
+
function kindIgnoredWarning(opts) {
|
|
106
|
+
const { requested, existingKind, binName, spaceId, path } = opts;
|
|
107
|
+
if (requested === undefined)
|
|
108
|
+
return null;
|
|
109
|
+
const actual = (0, data_provider_1.readWikiPageKind)(existingKind);
|
|
110
|
+
if (actual === requested)
|
|
111
|
+
return null;
|
|
112
|
+
return (`--kind was ignored: '${path}' already exists as a ${actual} page, and \`wiki write\` only sets ` +
|
|
113
|
+
`the kind of pages it creates. Change it with \`${binName} wiki update ${spaceId} ${path} ` +
|
|
114
|
+
`--kind ${requested}\`.`);
|
|
115
|
+
}
|
|
93
116
|
class WikiWrite extends base_command_1.BaseCommand {
|
|
94
117
|
// The markdown dialect note lives here, not only in SKRR_WIKI.md: --help is the
|
|
95
118
|
// one place a CLI user (or an agent with no docs) looks before writing, and
|
|
@@ -118,6 +141,11 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
118
141
|
'<%= config.bin %> wiki write <space-id> Engineering/deploy --file runbook.md',
|
|
119
142
|
'cat notes.md | <%= config.bin %> wiki write <space-id> notes --stdin',
|
|
120
143
|
'<%= config.bin %> wiki write <space-id> log --content "Shipped v2" --append',
|
|
144
|
+
'<%= config.bin %> wiki write <space-id> charter --kind charter --file charter.md',
|
|
145
|
+
'<%= config.bin %> wiki write <space-id> journal/2026-10-22 --kind journal_entry --stdin',
|
|
146
|
+
'<%= config.bin %> wiki write <space-id> Reviews/2026-w43 --kind report --create-only --stdin',
|
|
147
|
+
'<%= config.bin %> wiki write <space-id> charter --section "## Goals" --file goals.md --note "Tighter after the KR review"',
|
|
148
|
+
'<%= config.bin %> wiki write <space-id> charter --lead --file lead.md',
|
|
121
149
|
];
|
|
122
150
|
static args = {
|
|
123
151
|
space: core_1.Args.string({ description: 'Space ID', required: true, ignoreStdin: true }),
|
|
@@ -130,9 +158,33 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
130
158
|
stdin: core_1.Flags.boolean({ description: 'Read content from stdin' }),
|
|
131
159
|
html: core_1.Flags.boolean({ description: 'Treat the input as HTML instead of Markdown' }),
|
|
132
160
|
append: core_1.Flags.boolean({ description: 'Append instead of replacing (>> rather than >)' }),
|
|
161
|
+
'create-only': core_1.Flags.boolean({
|
|
162
|
+
description: 'Create a new page only. Refuse an existing path or a create race without replacing its content',
|
|
163
|
+
exclusive: ['append', 'section', 'lead'],
|
|
164
|
+
}),
|
|
133
165
|
title: core_1.Flags.string({
|
|
134
166
|
description: 'Title for a NEWLY-CREATED page (defaults to the slug). Retitle an existing page with `wiki update --title`',
|
|
135
167
|
}),
|
|
168
|
+
kind: core_1.Flags.string({
|
|
169
|
+
description: 'Kind for a NEWLY-CREATED page (default doc). A Space holds one live `charter`; its lead ' +
|
|
170
|
+
'section is read by every agent in the Space. Change an existing page with `wiki update --kind`',
|
|
171
|
+
options: [...data_provider_1.WIKI_PAGE_KINDS],
|
|
172
|
+
}),
|
|
173
|
+
section: core_1.Flags.string({
|
|
174
|
+
description: 'Replace ONE section of an existing page instead of the whole page: a heading line ' +
|
|
175
|
+
'(`## Goals`, which also fixes the level) or its text. The content replaces the heading and ' +
|
|
176
|
+
'everything under it, up to the next heading of the same or a higher level, so include the heading',
|
|
177
|
+
exclusive: ['lead', 'append'],
|
|
178
|
+
}),
|
|
179
|
+
lead: core_1.Flags.boolean({
|
|
180
|
+
description: 'Replace only the lead of an existing page: everything before its first `##` heading (for a ' +
|
|
181
|
+
'charter, the part every agent in the Space reads)',
|
|
182
|
+
exclusive: ['section', 'append'],
|
|
183
|
+
}),
|
|
184
|
+
note: core_1.Flags.string({
|
|
185
|
+
description: 'Why you are making the change. When the Space holds the write for approval it becomes a ' +
|
|
186
|
+
'suggestion on the page, and this is its first comment; otherwise it is not stored',
|
|
187
|
+
}),
|
|
136
188
|
};
|
|
137
189
|
async run() {
|
|
138
190
|
this.requireAuth();
|
|
@@ -155,9 +207,10 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
155
207
|
}
|
|
156
208
|
const format = flags.html ? 'html' : 'markdown';
|
|
157
209
|
const mode = flags.append ? 'append' : 'replace';
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
//
|
|
210
|
+
const partial = flags.section !== undefined || flags.lead === true;
|
|
211
|
+
// Create-or-write by default; --create-only refuses the existing branch.
|
|
212
|
+
// A lookup 404 means "create it", which also creates the folder chain via
|
|
213
|
+
// `folderPath` (mkdir -p). The server's conflict check below owns the race.
|
|
161
214
|
let existing = null;
|
|
162
215
|
try {
|
|
163
216
|
existing = await data_provider_1.dataService.getSpaceWikiPageByPath(args.space, args.path);
|
|
@@ -167,17 +220,47 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
167
220
|
this.handleApiError(err);
|
|
168
221
|
}
|
|
169
222
|
}
|
|
223
|
+
if (flags['create-only'] && existing) {
|
|
224
|
+
this.failWithCliError({
|
|
225
|
+
message: `Page '${args.path}' already exists (${existing.pageId}); --create-only changed nothing.`,
|
|
226
|
+
code: 'WIKI_PAGE_EXISTS',
|
|
227
|
+
status: 409,
|
|
228
|
+
exit: 1,
|
|
229
|
+
retryable: false,
|
|
230
|
+
details: { requestedPath: args.path, pageId: existing.pageId },
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
// A section or the lead is a part of a page that exists: there is nothing
|
|
234
|
+
// to create it in.
|
|
235
|
+
if (partial && !existing) {
|
|
236
|
+
this.failWithCliError({
|
|
237
|
+
message: `No page at '${args.path}' to replace ${flags.lead ? 'the lead of' : 'a section of'}. ` +
|
|
238
|
+
'Write the whole page first.',
|
|
239
|
+
code: 'WIKI_PAGE_NOT_FOUND',
|
|
240
|
+
status: 404,
|
|
241
|
+
exit: 1,
|
|
242
|
+
retryable: false,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
170
245
|
const { dir, name } = (0, wiki_1.splitParentPath)(args.path);
|
|
171
246
|
const writeInto = (pageId) => data_provider_1.dataService.writeSpaceWikiPageContent({
|
|
172
247
|
spaceId: args.space,
|
|
173
248
|
pageId,
|
|
174
|
-
data: {
|
|
249
|
+
data: {
|
|
250
|
+
content,
|
|
251
|
+
format,
|
|
252
|
+
mode,
|
|
253
|
+
...(flags.section !== undefined ? { section: flags.section } : {}),
|
|
254
|
+
...(flags.lead ? { lead: true } : {}),
|
|
255
|
+
...(flags.note ? { note: flags.note } : {}),
|
|
256
|
+
},
|
|
175
257
|
});
|
|
176
258
|
let page;
|
|
177
259
|
// `existing` decides which branch we OPEN with, never which one we end in:
|
|
178
260
|
// the lookup above can be stale (a CDN-cached 404 is the documented case),
|
|
179
261
|
// so the create below asks the server to refuse rather than rename, and a
|
|
180
|
-
// refusal is resolved by writing into whatever was really there.
|
|
262
|
+
// refusal is normally resolved by writing into whatever was really there.
|
|
263
|
+
// --create-only preserves that refusal instead of changing the winner.
|
|
181
264
|
let wroteIntoExisting = Boolean(existing);
|
|
182
265
|
try {
|
|
183
266
|
if (existing) {
|
|
@@ -193,6 +276,7 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
193
276
|
folderPath: dir || undefined,
|
|
194
277
|
content,
|
|
195
278
|
format,
|
|
279
|
+
...(flags.kind ? { kind: flags.kind } : {}),
|
|
196
280
|
// Never let the server rename an EXACTLY addressed path. Without
|
|
197
281
|
// this it answers 201 having created `x-2` beside `x`, and the
|
|
198
282
|
// write the user asked for silently did not happen.
|
|
@@ -202,7 +286,7 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
202
286
|
}
|
|
203
287
|
catch (err) {
|
|
204
288
|
const conflictId = conflictingPageId(err);
|
|
205
|
-
if (conflictId === undefined) {
|
|
289
|
+
if (conflictId === undefined || flags['create-only']) {
|
|
206
290
|
throw err;
|
|
207
291
|
}
|
|
208
292
|
// The page existed after all. This is the outcome the user asked
|
|
@@ -213,11 +297,50 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
213
297
|
}
|
|
214
298
|
}
|
|
215
299
|
catch (err) {
|
|
300
|
+
const charterConflict = (0, space_charter_1.charterConflictHint)(err, {
|
|
301
|
+
binName: this.config.bin,
|
|
302
|
+
spaceId: args.space,
|
|
303
|
+
});
|
|
304
|
+
if (charterConflict) {
|
|
305
|
+
this.failWithCliError({
|
|
306
|
+
message: charterConflict.message,
|
|
307
|
+
code: 'WIKI_CHARTER_EXISTS',
|
|
308
|
+
status: 409,
|
|
309
|
+
exit: 1,
|
|
310
|
+
retryable: false,
|
|
311
|
+
details: charterConflict.details,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
216
314
|
this.handleApiError(err);
|
|
217
315
|
}
|
|
316
|
+
// A write an unattended run makes may be held for approval by the Space's
|
|
317
|
+
// write policy (`202 pending_approval`): a journal entry or report create,
|
|
318
|
+
// or an append to the one it created (`--append`, OSK-17995), in its Run's
|
|
319
|
+
// approval bundle (OSK-17994); an edit of any other page's body as a
|
|
320
|
+
// suggestion on the page (OSK-17997). Nothing was written yet.
|
|
321
|
+
if (this.reportHeldSpaceWrite(page, { json: flags.json }))
|
|
322
|
+
return;
|
|
218
323
|
// Fallback for a server predating `conflict: 'fail'`, which answers 201
|
|
219
324
|
// with a renamed slug instead of 409. Unreachable against a current server.
|
|
220
325
|
if (!wroteIntoExisting && createdSlugCollided(name, page.slug)) {
|
|
326
|
+
if (flags['create-only']) {
|
|
327
|
+
this.failWithCliError({
|
|
328
|
+
message: `The server created '${page.path ?? page.slug}' (${page.pageId}) instead of '${args.path}'. ` +
|
|
329
|
+
'This server did not honor atomic --create-only. The existing page was not replaced, ' +
|
|
330
|
+
'and the newly created page has not been removed. Upgrade the server before retrying this operation.',
|
|
331
|
+
code: 'WIKI_CREATE_ONLY_UNSUPPORTED',
|
|
332
|
+
exit: 1,
|
|
333
|
+
retryable: false,
|
|
334
|
+
details: {
|
|
335
|
+
outcome: 'created_different_path',
|
|
336
|
+
requestedPath: args.path,
|
|
337
|
+
requestedSlug: name,
|
|
338
|
+
createdSlug: page.slug,
|
|
339
|
+
createdPath: page.path,
|
|
340
|
+
pageId: page.pageId,
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
}
|
|
221
344
|
this.failWithCliError({
|
|
222
345
|
message: `Wrote a DUPLICATE page: asked for '${args.path}' but the server already had that slug and created ` +
|
|
223
346
|
`'${page.path ?? page.slug}' (${page.pageId}) beside it. The content did NOT overwrite the original.\n` +
|
|
@@ -249,6 +372,17 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
249
372
|
`it creates. Retitle it with \`${this.config.bin} wiki update ${args.space} ${page.path ?? args.path} ` +
|
|
250
373
|
`--title ${JSON.stringify(flags.title)}\` (the slug is kept, so stored paths stay valid).`);
|
|
251
374
|
}
|
|
375
|
+
const ignoredKind = wroteIntoExisting
|
|
376
|
+
? kindIgnoredWarning({
|
|
377
|
+
requested: flags.kind,
|
|
378
|
+
existingKind: page.kind,
|
|
379
|
+
binName: this.config.bin,
|
|
380
|
+
spaceId: args.space,
|
|
381
|
+
path: page.path ?? args.path,
|
|
382
|
+
})
|
|
383
|
+
: null;
|
|
384
|
+
if (ignoredKind)
|
|
385
|
+
this.warn(ignoredKind);
|
|
252
386
|
const withUrl = (0, web_url_1.withWikiPageUrl)(this.cliConfig.baseURL, page);
|
|
253
387
|
if (flags.json) {
|
|
254
388
|
this.log(JSON.stringify(withUrl, null, 2));
|
|
@@ -260,6 +394,10 @@ class WikiWrite extends base_command_1.BaseCommand {
|
|
|
260
394
|
let verb = 'Created';
|
|
261
395
|
if (wroteIntoExisting) {
|
|
262
396
|
verb = flags.append ? 'Appended to' : 'Updated';
|
|
397
|
+
if (flags.lead)
|
|
398
|
+
verb = 'Replaced the lead of';
|
|
399
|
+
if (flags.section !== undefined)
|
|
400
|
+
verb = `Replaced the section ${JSON.stringify(flags.section)} of`;
|
|
263
401
|
}
|
|
264
402
|
this.log(`${verb} ${page.path ?? args.path} (${page.pageId}).`);
|
|
265
403
|
if (withUrl.url)
|