silvermoon 0.0.3 → 0.1.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/docs/reference.md CHANGED
@@ -44,8 +44,9 @@ Each world is an opaque Git tree:
44
44
  - `deploymentRevision` identifies `outer/` and includes both nested worlds.
45
45
 
46
46
  `status.yaml` and `ledger.md` are outside all three world trees. The repository
47
- object format in use determines revision shape; Silvermoon validates object
48
- types and candidate bindings rather than interpreting world contents.
47
+ object format in use determines revision shape. Silvermoon validates canonical
48
+ revision shape, computes the current world trees, and compares those values to
49
+ status facts rather than interpreting world contents.
49
50
 
50
51
  ## Status File
51
52
 
@@ -66,10 +67,21 @@ world revision and does not change lifecycle decisions. Explicit
66
67
  `abandoned: false`, derived state, criteria mirrors, source locators, unknown
67
68
  keys, YAML aliases or anchors, comments, and noncanonical YAML are rejected.
68
69
 
69
- Effective language resolves as `idea language > project preferredLanguage >
70
- user preferredLanguage > en-US`. JSON reports expose
71
- `language: { tag, source }`; human output shows the same values. Missing idea
72
- language remains dynamically inherited and is never written back.
70
+ Effective content language resolves as `idea language > project
71
+ preferredLanguage > user preferredLanguage > en-US`. Every complete
72
+ observation exposes the resolved non-empty tag as
73
+ `configuration.preferredLanguage`. Missing idea language remains dynamically
74
+ inherited and is never written back. Dialogue project status presents this
75
+ effective value as `content language` (`内容语言`).
76
+
77
+ Every command observation also exposes an independent `outputLanguage`.
78
+ Silvermoon's built-in output locales are exactly `en-US` and `zh-CN`.
79
+ `whats-next --language <tag>` and `check --language <tag>` normalize casing
80
+ before enforcing that allowlist, apply only to the current invocation, and
81
+ take display precedence over content language. Without an explicit output
82
+ override, content tags beginning with `zh` select `zh-CN`; every other content
83
+ tag selects `en-US`. Output selection never writes configuration or idea
84
+ status.
73
85
 
74
86
  State is derived in order:
75
87
 
@@ -84,51 +96,224 @@ State is derived in order:
84
96
  ## Public Commands
85
97
 
86
98
  ```sh
87
- silvermoon whats-next [idea]
88
- silvermoon create-idea [--language <tag>]
89
- silvermoon check [--remote | --commit <revision> | --staged | --worktree]
99
+ silvermoon whats-next [idea] [--language <en-US|zh-CN>] [--trace <file.trace.jsonl>]
100
+ silvermoon create-idea [--language <tag>] [--trace <file.trace.jsonl>]
101
+ silvermoon check [--remote | --commit <revision> | --staged | --worktree] [--language <en-US|zh-CN>] [--trace <file.trace.jsonl>]
102
+ ```
103
+
104
+ `whats-next` and `create-idea` build one dialogue envelope:
105
+
106
+ ```json
107
+ {
108
+ "intention": {
109
+ "command": "whats-next",
110
+ "args": {
111
+ "idea": null,
112
+ "language": null
113
+ }
114
+ },
115
+ "observation": {
116
+ "outputLanguage": "en-US"
117
+ },
118
+ "outcomes": [],
119
+ "instructions": ""
120
+ }
90
121
  ```
91
122
 
92
- `whats-next` returns one highest-priority action after repository and onboarding
93
- diagnosis. JSON reports include `observedPrimaryCommit`, `language`,
94
- `selectedIdea`, and exactly one `action`. When onboarding passes without gaps,
95
- the report omits `onboarding`. Otherwise `onboarding.gaps` contains only unmet,
96
- conflicting, or unknown requirements, preserving their stable IDs, statuses,
97
- blocking flags, dependencies, observed facts, and structured remediation. The
98
- compact onboarding report also includes a recommended action and recheck
99
- command. Human-readable output follows the same quiet-success, actionable-gap
100
- semantics. Use `check` when a complete repository diagnostic is required.
101
-
102
- Execution source is classified as `source-checkout`, `project-local`,
103
- `temporary`, `global`, or `unknown`. Temporary execution can bootstrap
104
- diagnosis; normal idea work requires the exact project dependency, installed
105
- package, and matching repository-local skill.
106
-
107
- `create-idea` applies the same hygiene preflight and then creates one canonical
108
- scaffold. Its optional language override is normalized before preflight and is
109
- the only command override; without it the status remains dynamically
110
- inherited. It does not stage, commit, push, or record approval.
123
+ - `intention` contains the command and normalized business arguments. For
124
+ `whats-next` and `check`, `args.language` is the canonical temporary output
125
+ override or `null`. Output format is not part of the intention.
126
+ - `observation` describes the reliable facts for the requested command and
127
+ intent, not a mandatory global idea inventory. `outputLanguage` is present
128
+ even when Git, configuration, or a requested snapshot is unavailable.
129
+ - `outcomes` records only high-level repository side effects actually
130
+ attempted by this invocation. Each item has `type`, `status` (`success` or
131
+ `failure`), and `summary`. An empty array means no side effect was attempted.
132
+ - `instructions` contains all ordered next-step guidance for the current
133
+ readiness layer. A single remediation is plain text; multiple remediations
134
+ are numbered in priority order.
135
+
136
+ Default dialogue output renders the same report with concise lists under
137
+ `## Current instruction`, `## Project status`, and `## Suggested next steps`
138
+ (in Chinese: `## 本次指示`, `## 项目现状`, `## 下一步建议`). The optional
139
+ `## Actions and results` (`## 本次操作及结果`) appears only when a visible
140
+ outcome remains. A successful fetch is omitted from text when local HEAD
141
+ matches the fetched primary; failed fetches and synchronization problems remain
142
+ visible. JSON always records attempted outcomes, even when text omits routine
143
+ success. `--json` serializes the same decision; there is no YAML output or
144
+ second reasoning path. Within the project-status section, nonempty navigation
145
+ candidates and observed problems appear under `### Ideas you can continue` and
146
+ `### Issues to address` (in Chinese: `### 可继续推进的想法` and
147
+ `### 需要处理的问题`). Suggested next steps refer to these candidates without
148
+ repeating their inventory. Empty sections are omitted. Dialogue exit status
149
+ `0` means a trustworthy report was formed, even when it reports readiness
150
+ blocks or a failed operation; `1` means an internal failure prevented a
151
+ trustworthy report; `2` means invalid CLI usage.
152
+
153
+ All commands accept `--trace <file.trace.jsonl>`. If the supplied path does not
154
+ end with the exact lowercase `.trace.jsonl` suffix, Silvermoon appends it while
155
+ preserving the directory and original name. Repository-local `*.trace.jsonl`
156
+ files are ignored by the canonical repository. The trace is newline-delimited
157
+ JSON with paired `span-start` and `span-end` events, UTC timestamps, monotonic
158
+ `durationMs`, parent span IDs, and success or error status. It covers the
159
+ command, snapshot observation, adoption, user configuration, idea layout,
160
+ repository readiness, temporary snapshot materialization, and individual Git
161
+ commands. Git events record the subcommand and result but not command arguments,
162
+ stdout, or stderr. The path is relative to the caller's working directory when
163
+ not absolute. Events are buffered so a trace inside the repository cannot
164
+ affect that invocation's worktree observation. The file is written after the
165
+ measured command work finishes and uses exclusive creation, so an existing
166
+ normalized target is never overwritten. The top command span records the
167
+ canonical output-language override or `null` for `whats-next` and `check`.
168
+
169
+ Unsupported output locales, empty values, and invalid BCP 47 tags are usage
170
+ errors with exit status `2`, before repository inspection or fetch.
171
+
172
+ Observations are discriminated by command intent and `state`:
173
+
174
+ - `project-setup-required` uses `observedThrough` (`root`, `version`,
175
+ `configuration`, or `ideas`) to identify the deepest reliable cumulative
176
+ shape. Fields beyond that boundary are absent rather than null or fabricated.
177
+ - `repository-sync-required` is used by `whats-next` and always includes
178
+ `root`, `version`, `configuration`, `ideas`, and at least one `problem`.
179
+ - `repository-preparation-required` is used by `create-idea` when its local
180
+ safety checks fail. It includes `root`, `version`, `configuration`, and at
181
+ least one `problem`, but no idea inventory or remote synchronization facts.
182
+ - Bare `whats-next` returns `navigation-ready` with `ideas.counts` and
183
+ `ideas.activeIdeas` (possibly empty). It never selects a candidate.
184
+ - Selected `whats-next` returns `idea-selected` with only `selectedIdea`
185
+ (`id`, optional `alias`, lifecycle `state`), including terminal ideas.
186
+ Unknown selectors return `idea-not-found` with `candidates`, not a
187
+ fabricated selected idea.
188
+ - After a successful `create-idea` preflight, `idea-created` carries
189
+ `createdIdea` (`id`, `path`, `state: "preparing"`). This confirms
190
+ pre-creation readiness, not a clean post-creation worktree. An attempted but
191
+ failed scaffold returns `idea-create-failed` without `createdIdea`; preflight
192
+ failures retain their setup or local preparation state.
193
+
194
+ Dialogue versions have `version.type: "worktree"`. When present, `ideas.counts` has
195
+ `preparing`, `implementing`, `deploying`, `completed`, and `abandoned`;
196
+ `activeIdeas` contains only minimal references for the first three states.
197
+ Problems have only stable `type` and natural-language `summary`; remediation
198
+ belongs in dialogue `instructions`.
199
+
200
+ Project setup is ecosystem-neutral. It checks Git, configuration schema
201
+ compatibility, and exact canonical skill content at
202
+ `.agents/skills/silvermoon`. It does not inspect execution source or require a
203
+ package manager, `package.json`, project-local Silvermoon dependency, or
204
+ `node_modules`.
205
+
206
+ `whats-next` checks local conflicts and changes before remote access, then HEAD
207
+ and upstream identity, then fetch and ancestry. A local branch may have any
208
+ name, but its upstream must identify the configured repository and primary
209
+ branch. Change summaries have fixed item and UTF-8 byte budgets and provide
210
+ full counts and omitted counts; instructions require inspection of the complete
211
+ change set without prescribing a particular diff tool. Bare navigation
212
+ never selects an idea: it always lists every active idea alongside the option
213
+ to discuss and run `create-idea`.
214
+
215
+ `create-idea` requires the configured primary branch and upstream plus a clean
216
+ worktree, then creates one canonical scaffold. It does not fetch, compare
217
+ remote ancestry, or require local HEAD to match the remote tip. Its optional
218
+ content-language choice accepts any canonical BCP 47 tag, is normalized before
219
+ preflight, and is persisted to the new idea; without it the status remains
220
+ dynamically inherited. It does not stage, commit, push, or record approval.
111
221
 
112
222
  ## Validation Targets
113
223
 
114
- - `check` validates only the committed `HEAD` snapshot and reads primary
115
- coordinates from that snapshot.
224
+ - `check` validates only the committed `HEAD` snapshot. It is not a
225
+ pre-commit check.
116
226
  - `check --worktree` validates the hypothetical commit formed from `HEAD`, the
117
227
  index, unstaged changes, and nonignored untracked files.
118
- - `check --staged` validates the index snapshot.
228
+ - `check --staged` validates the index snapshot for a pre-commit hook.
119
229
  - `check --commit <revision>` validates one local commit snapshot.
120
230
  - `check --remote` fetches primary using committed coordinates, validates its
121
- immutable tip, and proves retained revision facts against complete reachable
122
- primary history.
231
+ immutable tip, and does not audit the history or provenance of retained
232
+ revision facts. Unrelated skill or idea findings in local `HEAD` do not block
233
+ locating and validating the remote snapshot.
123
234
 
124
235
  Targets are mutually exclusive and never change the caller's branch, index, or
125
- worktree. Exit status `0` means success, `1` means validation or operational
126
- failure, and `2` means invalid CLI usage. `--json` emits the stable report
127
- envelope.
236
+ worktree. `--remote` may fetch Git objects, but it does not produce dialogue
237
+ outcomes. `check` validates the selected snapshot's project contract only:
238
+ Git, configuration, canonical skill, idea layout, world revisions, and status.
239
+ Its result depends on the materialized tree, not commit parents, parent order,
240
+ branch, merge/cherry-pick path, or retained decision reachability. A canonical
241
+ decision revision that differs from the current world is a valid historical
242
+ fact and naturally derives an earlier lifecycle state; it need not still exist
243
+ in the local object database. `check` does not check local worktree cleanliness,
244
+ upstream, or ancestry readiness, route ideas, or give next-step instructions.
245
+
246
+ Unlike dialogue commands, `check --json` contains **only** `intention` and
247
+ `observation`:
248
+
249
+ ```json
250
+ {
251
+ "intention": {
252
+ "command": "check",
253
+ "args": {
254
+ "target": { "type": "staged" },
255
+ "language": null
256
+ }
257
+ },
258
+ "observation": {
259
+ "state": "project-ready",
260
+ "root": "D:\\Code\\silvermoon",
261
+ "version": { "type": "staged" },
262
+ "outputLanguage": "en-US",
263
+ "configuration": {
264
+ "primaryRepository": "https://example.com/owner/repository.git",
265
+ "primaryBranch": "main",
266
+ "preferredLanguage": "en-US"
267
+ },
268
+ "ideas": {
269
+ "counts": {
270
+ "preparing": 0,
271
+ "implementing": 0,
272
+ "deploying": 0,
273
+ "completed": 0,
274
+ "abandoned": 0
275
+ },
276
+ "activeIdeas": []
277
+ },
278
+ "problems": []
279
+ }
280
+ }
281
+ ```
282
+
283
+ `intention.args.target.type` is `head`, `staged`, `worktree`, `commit`, or
284
+ `remote`; a requested `--commit` revision stays in intention. A resolved
285
+ `HEAD` or local commit is reported in observation as
286
+ `version: { type: "commit", commit: "<oid>" }`; a fetched remote tip is
287
+ `{ type: "remote", commit: "<oid>" }`. Failed commit resolution or fetch
288
+ reports `commit: null` and a problem. Staged and worktree versions only
289
+ contain `type`.
290
+
291
+ `--language en-US|zh-CN` is orthogonal to every target. It changes only
292
+ Silvermoon-owned natural-language framing and leaves the target, snapshot,
293
+ validation state, problems, and exit status unchanged.
294
+
295
+ The `check` observation has its own discriminated states:
296
+
297
+ - `project-ready` has root, version, resolved configuration, idea summary,
298
+ and empty problems. It says nothing about repository synchronization.
299
+ - `project-setup-required` has nonempty problems and the same progressive
300
+ `observedThrough` variants as project setup in the dialogue.
301
+ - `check-unavailable` has known root, target version, and nonempty problems
302
+ when the target cannot be resolved, fetched, or materialized; it does not
303
+ pretend the project was checked.
304
+
305
+ There are no `outcomes` or `instructions` keys in a check report. Its default
306
+ human-readable output gives only the target, validation conclusion, and
307
+ problems, not the dialogue's four sections. Text and JSON derive from the same
308
+ validation result. Exit code `0` means `project-ready` and is the **only**
309
+ pre-commit/CI pass condition. Exit code `1` means invalid, unavailable, or an
310
+ internal failure and must fail closed; `2` means invalid CLI usage. Do not
311
+ infer success merely from a rendered report or empty-looking output.
128
312
 
129
313
  Runtime checks verify canonical YAML, fixed paths, the three world entries,
130
- unique aliases, Git object format, tree object types, per-world candidate
131
- revision binding, and acceptance history.
314
+ unique aliases, Git object format, current world tree resolution, and lifecycle
315
+ derivation from the selected snapshot. They do not infer newly made decisions
316
+ from a parent diff or audit decision provenance through history.
132
317
 
133
318
  ## Schemas
134
319
 
@@ -10,34 +10,49 @@ The shared authority is `https://github.com/shazhou-ww/silvermoon.git` on
10
10
  optional transport and are not protocol state.
11
11
 
12
12
  ```sh
13
- silvermoon whats-next [idea] --json
14
- silvermoon create-idea --json
13
+ silvermoon whats-next [idea]
14
+ silvermoon whats-next [idea] --language zh-CN
15
+ silvermoon create-idea
15
16
  silvermoon check
17
+ silvermoon check --language en-US
16
18
  silvermoon check --worktree
17
19
  silvermoon check --staged
18
20
  silvermoon check --commit HEAD
19
21
  silvermoon check --remote
20
22
  ```
21
23
 
22
- Use the report's `observedPrimaryCommit` as the expected remote tip. When
24
+ Use the primary commit stated in the report as the expected remote tip. When
23
25
  primary moves, reobserve instead of replaying approval or acceptance.
24
26
 
25
27
  Choose the entry command from the user's intent. Explicit new-idea requests use
26
- `silvermoon create-idea --json` even when unrelated active ideas exist; all
27
- navigation uses `silvermoon whats-next [idea] --json`. Both commands apply the
28
- same branch, conflict, worktree, and ancestry hygiene. If hygiene blocks an
29
- explicit creation, perform only that blocking action and then retry
30
- `create-idea` so active-idea selection cannot replace the pending create intent.
28
+ `silvermoon create-idea` even when unrelated active ideas exist; all navigation
29
+ uses `silvermoon whats-next [idea]`. Add `--json` only for a programmatic
30
+ consumer. Both commands apply the
31
+ same project checks, but their repository readiness differs. `whats-next`
32
+ checks local hygiene and remote ancestry. `create-idea` requires the configured
33
+ primary branch and upstream plus a clean worktree, without fetching or requiring
34
+ HEAD to match the remote tip. If hygiene blocks explicit creation, perform only
35
+ that blocking action and then retry `create-idea` so active-idea selection
36
+ cannot replace the pending create intent.
37
+
38
+ Use `--language en-US|zh-CN` with `whats-next` or `check` only when the user
39
+ explicitly requests a temporary output locale. Preserve the canonical option
40
+ on every hygiene retry. It never changes the content language recorded in
41
+ project, user, or idea configuration. `create-idea --language <tag>` remains a
42
+ separate persistent content-language choice and accepts any canonical BCP 47
43
+ tag.
31
44
 
32
45
  ## Decisions And Publication
33
46
 
34
- `whats-next` is read-only. Human approvals, implementation acceptance,
35
- deployment acceptance, and abandonment are ordinary edits to one idea
36
- `status.yaml` after an explicit decision. Validate the candidate and publish a
37
- normal non-force commit. Prefer status-only decision commits when practical.
47
+ `whats-next` may fetch after local readiness passes, but it does not move the
48
+ worktree, index, branches, or named refs. Human approvals, implementation
49
+ acceptance, deployment acceptance, and abandonment are ordinary edits to one
50
+ idea `status.yaml` after an explicit decision. Validate the candidate and
51
+ publish a normal non-force commit. Prefer status-only decision commits when
52
+ practical.
38
53
 
39
54
  The required idea-root `ledger.md` is the Agent continuation surface. After
40
- repository hygiene and lifecycle routing, combine the reported action, world
55
+ repository hygiene and lifecycle routing, combine the reported instructions, world
41
56
  contracts, and unchecked Implementation or Deployment ledger entries to infer
42
57
  the next work. Update matching world headings and ledger entries together, and
43
58
  reset a checked item when its requirement or proof changes materially. Ledger
@@ -59,3 +74,9 @@ branches.
59
74
  and `git diff --check` before delivery review.
60
75
  - Use `silvermoon check --commit HEAD` for checked-out CI and
61
76
  `silvermoon check --remote` for complete primary-history evidence.
77
+ - Use `silvermoon check --staged` in pre-commit hooks: default `check` validates
78
+ committed `HEAD`, not the pending index. `check` validates only the chosen
79
+ project's snapshot, not repository synchronization or idea navigation.
80
+ Only exit code `0` permits the commit; `1` means invalid or unavailable and
81
+ `2` means invalid usage. Its JSON contains `intention` and `observation`,
82
+ not dialogue `outcomes` or `instructions`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silvermoon",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "description": "The project spirit that checks repository state and answers what's next.",
5
5
  "packageManager": "pnpm@11.22.0",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "schema"
22
22
  ],
23
23
  "scripts": {
24
- "check": "npm run lint:markdown && npm run check:quick && npm run test:integration && npm run pack:check && npm run test:e2e && npm run check:skills",
24
+ "check": "node scripts/run-checks.mjs",
25
25
  "check:quick": "node --check bin/silvermoon.js && npm test",
26
26
  "check:skills": "node scripts/sync-skills.mjs --check && npx skills add . --list",
27
27
  "lint:markdown": "markdownlint-cli2",
@@ -29,15 +29,15 @@
29
29
  "const": true
30
30
  },
31
31
  "approvedRevision": {
32
- "description": "Accepted Ideal World (道心) tree object ID.",
32
+ "description": "Accepted Ideal World (理想世界) tree object ID.",
33
33
  "$ref": "definitions.schema.json#/$defs/objectId"
34
34
  },
35
35
  "implementationAcceptedRevision": {
36
- "description": "Accepted Inner World (内景) tree object ID.",
36
+ "description": "Accepted Inner World (主体世界) tree object ID.",
37
37
  "$ref": "definitions.schema.json#/$defs/objectId"
38
38
  },
39
39
  "deploymentAcceptedRevision": {
40
- "description": "Accepted Outer World (现世) tree object ID.",
40
+ "description": "Accepted Outer World (现实世界) tree object ID.",
41
41
  "$ref": "definitions.schema.json#/$defs/objectId"
42
42
  }
43
43
  }