@awiki/cli 0.0.1-beta.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.
Files changed (119) hide show
  1. package/.github/workflows/release.yml +44 -0
  2. package/.goreleaser.yml +44 -0
  3. package/AGENTS.md +60 -0
  4. package/CLAUDE.md +192 -0
  5. package/README.md +2 -0
  6. package/docs/architecture/awiki-command-v2.md +955 -0
  7. package/docs/architecture/awiki-skill-architecture.md +475 -0
  8. package/docs/architecture/awiki-v2-architecture.md +1063 -0
  9. package/docs/architecture//345/217/202/350/200/203/346/226/207/346/241/243/cli-init.md +1008 -0
  10. package/docs/architecture//345/217/202/350/200/203/346/226/207/346/241/243/output-format.md +407 -0
  11. package/docs/architecture//345/217/202/350/200/203/346/226/207/346/241/243/overall-init.md +741 -0
  12. package/docs/harness/review-spec.md +474 -0
  13. package/docs/installation.md +372 -0
  14. package/docs/plan/awiki-v2-implementation-plan.md +903 -0
  15. package/docs/plan/phase-0/adr-index.md +56 -0
  16. package/docs/plan/phase-0/audit-findings.md +251 -0
  17. package/docs/plan/phase-0/capability-mapping.md +108 -0
  18. package/docs/plan/phase-0/implementation-constraints.md +363 -0
  19. package/docs/publish.md +169 -0
  20. package/go.mod +29 -0
  21. package/go.sum +73 -0
  22. package/internal/anpsdk/registry.go +63 -0
  23. package/internal/authsdk/session.go +351 -0
  24. package/internal/buildinfo/buildinfo.go +34 -0
  25. package/internal/cli/app.go +136 -0
  26. package/internal/cli/app_test.go +88 -0
  27. package/internal/cli/debug.go +104 -0
  28. package/internal/cli/group.go +263 -0
  29. package/internal/cli/id.go +473 -0
  30. package/internal/cli/init.go +134 -0
  31. package/internal/cli/msg.go +228 -0
  32. package/internal/cli/page.go +267 -0
  33. package/internal/cli/root.go +499 -0
  34. package/internal/cli/runtime.go +232 -0
  35. package/internal/cli/upgrade.go +60 -0
  36. package/internal/cmdmeta/catalog.go +203 -0
  37. package/internal/cmdmeta/catalog_test.go +21 -0
  38. package/internal/config/config.go +399 -0
  39. package/internal/config/config_test.go +104 -0
  40. package/internal/config/write.go +37 -0
  41. package/internal/content/service.go +314 -0
  42. package/internal/content/service_test.go +165 -0
  43. package/internal/content/types.go +44 -0
  44. package/internal/docs/topics.go +110 -0
  45. package/internal/doctor/doctor.go +306 -0
  46. package/internal/identity/client.go +267 -0
  47. package/internal/identity/did.go +85 -0
  48. package/internal/identity/did_test.go +50 -0
  49. package/internal/identity/layout.go +206 -0
  50. package/internal/identity/legacy.go +378 -0
  51. package/internal/identity/public.go +70 -0
  52. package/internal/identity/public_test.go +73 -0
  53. package/internal/identity/readiness.go +74 -0
  54. package/internal/identity/service.go +826 -0
  55. package/internal/identity/store.go +385 -0
  56. package/internal/identity/store_test.go +180 -0
  57. package/internal/identity/types.go +204 -0
  58. package/internal/message/auth.go +167 -0
  59. package/internal/message/group_service.go +838 -0
  60. package/internal/message/group_wire.go +350 -0
  61. package/internal/message/group_wire_test.go +67 -0
  62. package/internal/message/helpers.go +61 -0
  63. package/internal/message/http_client.go +334 -0
  64. package/internal/message/proof.go +156 -0
  65. package/internal/message/proof_test.go +61 -0
  66. package/internal/message/service.go +696 -0
  67. package/internal/message/service_test.go +97 -0
  68. package/internal/message/types.go +155 -0
  69. package/internal/message/wire.go +100 -0
  70. package/internal/message/wire_test.go +49 -0
  71. package/internal/message/ws_proxy_client.go +151 -0
  72. package/internal/output/output.go +350 -0
  73. package/internal/output/output_test.go +48 -0
  74. package/internal/runtime/config.go +117 -0
  75. package/internal/runtime/config_test.go +46 -0
  76. package/internal/runtime/listener/files.go +65 -0
  77. package/internal/runtime/listener/manager.go +142 -0
  78. package/internal/runtime/listener/server.go +983 -0
  79. package/internal/runtime/listener/server_test.go +319 -0
  80. package/internal/runtime/listener/sysproc_unix.go +17 -0
  81. package/internal/runtime/listener/sysproc_windows.go +13 -0
  82. package/internal/runtime/listener/types.go +21 -0
  83. package/internal/runtime/listener/wsclient.go +299 -0
  84. package/internal/runtime/listener/wsclient_test.go +41 -0
  85. package/internal/store/dao.go +632 -0
  86. package/internal/store/dao_test.go +87 -0
  87. package/internal/store/helpers.go +197 -0
  88. package/internal/store/import.go +499 -0
  89. package/internal/store/import_test.go +103 -0
  90. package/internal/store/open.go +71 -0
  91. package/internal/store/query.go +151 -0
  92. package/internal/store/schema.go +277 -0
  93. package/internal/store/schema_test.go +56 -0
  94. package/internal/store/types.go +177 -0
  95. package/internal/update/update.go +368 -0
  96. package/package.json +17 -0
  97. package/scripts/install.js +171 -0
  98. package/scripts/release/release-prerelease.sh +86 -0
  99. package/scripts/release/tag-release.sh +66 -0
  100. package/scripts/release/withdraw-release.sh +78 -0
  101. package/scripts/run.js +69 -0
  102. package/skills/README.md +32 -0
  103. package/skills/awiki-bundle/SKILL.md +76 -0
  104. package/skills/awiki-debug/SKILL.md +80 -0
  105. package/skills/awiki-group/SKILL.md +111 -0
  106. package/skills/awiki-id/SKILL.md +123 -0
  107. package/skills/awiki-msg/SKILL.md +131 -0
  108. package/skills/awiki-page/SKILL.md +93 -0
  109. package/skills/awiki-people/SKILL.md +66 -0
  110. package/skills/awiki-runtime/SKILL.md +137 -0
  111. package/skills/awiki-shared/SKILL.md +124 -0
  112. package/skills/awiki-workflow-discovery/SKILL.md +93 -0
  113. package/skills/awiki-workflow-onboarding/SKILL.md +119 -0
  114. package/skills/manifests/skills.yaml +260 -0
  115. package/skills/templates/bundle-skill-template.md +42 -0
  116. package/skills/templates/debug-skill-template.md +44 -0
  117. package/skills/templates/domain-skill-template.md +56 -0
  118. package/skills/templates/shared-skill-template.md +46 -0
  119. package/skills/templates/workflow-skill-template.md +46 -0
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5
+ cd "${ROOT_DIR}"
6
+
7
+ VERSION="${1:-}"
8
+
9
+ if [ -z "${VERSION}" ]; then
10
+ echo "Usage: scripts/release/withdraw-release.sh <version>" >&2
11
+ echo "Example: scripts/release/withdraw-release.sh 0.1.0" >&2
12
+ echo " scripts/release/withdraw-release.sh 0.2.0-beta.1" >&2
13
+ exit 1
14
+ fi
15
+
16
+ TAG="v${VERSION}"
17
+ EXECUTE="${AWIKI_CLI_WITHDRAW_EXECUTE:-0}"
18
+
19
+ echo "Preparing to withdraw awiki-cli version ${VERSION} (tag ${TAG})."
20
+ echo
21
+
22
+ if ! git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
23
+ echo "Warning: local tag ${TAG} does not exist." >&2
24
+ else
25
+ echo "Local tag ${TAG} exists."
26
+ fi
27
+
28
+ if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q .; then
29
+ echo "Remote tag ${TAG} exists on origin."
30
+ else
31
+ echo "Warning: remote tag ${TAG} does not exist on origin." >&2
32
+ fi
33
+
34
+ echo
35
+ echo "Recommended rollback actions:"
36
+ echo
37
+ echo "1) Delete Git tag (local + origin):"
38
+ echo " git tag -d ${TAG} || true"
39
+ echo " git push origin :refs/tags/${TAG} || true"
40
+ echo
41
+ echo "2) Adjust GitHub Release (requires GitHub CLI 'gh'):"
42
+ echo " gh release delete ${TAG} --yes || true"
43
+ echo
44
+ echo "3) Adjust npm registry state for @awiki/cli@${VERSION}:"
45
+ echo " # Option A: mark deprecated but keep the version:"
46
+ echo " npm deprecate @awiki/cli@${VERSION} \"Deprecated due to bad release; please upgrade.\""
47
+ echo
48
+ echo " # Option B: move dist-tags away from the bad version (if applicable):"
49
+ echo " # npm dist-tag add @awiki/cli@<good-version> latest"
50
+ echo " # npm dist-tag rm @awiki/cli@${VERSION} latest"
51
+ echo
52
+ echo " # Option C: unpublish (only for very new versions; may be restricted by npm policy):"
53
+ echo " # npm unpublish @awiki/cli@${VERSION}"
54
+ echo
55
+
56
+ if [ "${EXECUTE}" != "1" ]; then
57
+ echo "AWIKI_CLI_WITHDRAW_EXECUTE is not set to 1; no destructive actions will be executed."
58
+ echo "Review the above commands carefully, then re-run with:"
59
+ echo
60
+ echo " AWIKI_CLI_WITHDRAW_EXECUTE=1 scripts/release/withdraw-release.sh ${VERSION}"
61
+ echo
62
+ exit 0
63
+ fi
64
+
65
+ echo "AWIKI_CLI_WITHDRAW_EXECUTE=1 set; executing rollback commands..."
66
+
67
+ set +e
68
+
69
+ git tag -d "${TAG}" 2>/dev/null || true
70
+ git push origin ":refs/tags/${TAG}" || true
71
+
72
+ if command -v gh >/dev/null 2>&1; then
73
+ gh release delete "${TAG}" --yes || true
74
+ else
75
+ echo "Warning: GitHub CLI 'gh' not found; skipping GitHub Release deletion." >&2
76
+ fi
77
+
78
+ echo "Rollback commands executed. You may still need to run npm deprecate/dist-tag commands manually as appropriate."
package/scripts/run.js ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { spawn } = require('child_process');
7
+
8
+ function findBinary() {
9
+ const rootDir = path.resolve(__dirname, '..');
10
+ const binDir = path.join(rootDir, 'bin');
11
+ const exeName = process.platform === 'win32' ? 'awiki-cli.exe' : 'awiki-cli';
12
+ return path.join(binDir, exeName);
13
+ }
14
+
15
+ function fileExists(p) {
16
+ try {
17
+ fs.accessSync(p, fs.constants.F_OK);
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ function getPackageVersion() {
25
+ try {
26
+ const pkg = require(path.resolve(__dirname, '..', 'package.json'));
27
+ return typeof pkg.version === 'string' ? pkg.version : 'unknown';
28
+ } catch {
29
+ return 'unknown';
30
+ }
31
+ }
32
+
33
+ function run() {
34
+ const binPath = findBinary();
35
+
36
+ if (!fileExists(binPath)) {
37
+ const version = getPackageVersion();
38
+ console.error(`[awiki-cli] Binary not found at ${binPath}.`);
39
+ console.error('[awiki-cli] Please download it first, for example:');
40
+ console.error(' npm run install-binary');
41
+ console.error('');
42
+ console.error('If you installed this package globally, you may need to run the command with the same package manager (npm/pnpm/yarn).');
43
+ console.error(`Current package version: ${version}`);
44
+ process.exit(1);
45
+ }
46
+
47
+ const args = process.argv.slice(2);
48
+ const child = spawn(binPath, args, { stdio: 'inherit' });
49
+
50
+ child.on('exit', code => {
51
+ process.exit(code ?? 1);
52
+ });
53
+
54
+ child.on('error', err => {
55
+ console.error(`[awiki-cli] Failed to start binary: ${err.message}`);
56
+ process.exit(1);
57
+ });
58
+ }
59
+
60
+ if (require.main === module) {
61
+ run();
62
+ }
63
+
64
+ module.exports = {
65
+ _internal: {
66
+ findBinary,
67
+ fileExists,
68
+ },
69
+ };
@@ -0,0 +1,32 @@
1
+ # awiki Skills
2
+
3
+ This directory contains the awiki skill set for the current `awiki-cli` product surface.
4
+
5
+ ## Structure
6
+
7
+ - `awiki-bundle/`: routing entrypoint
8
+ - `awiki-shared/`: shared rules and safety boundaries
9
+ - `awiki-*/`: domain, workflow, and debug skills
10
+ - `manifests/skills.yaml`: structured skill index
11
+ - `templates/`: authoring templates for future skills
12
+
13
+ ## Current Source of Truth
14
+
15
+ Skill maintenance currently follows two coordinated sources:
16
+
17
+ 1. `internal/cmdmeta/catalog.go` for command contract and implementation status
18
+ 2. `skills/manifests/skills.yaml` for skill routing, grouping, and ownership
19
+
20
+ If they disagree:
21
+
22
+ - command existence and implementation status come from `cmdmeta`
23
+ - skill ownership and routing come from `skills.yaml`
24
+
25
+ ## Maintenance Rules
26
+
27
+ - Use `awiki-cli` in command examples
28
+ - Keep shared rules in `awiki-shared` only
29
+ - Mark unimplemented capabilities as `partial` or `planned`
30
+ - Prefer canonical commands over shortcuts or imagined aliases
31
+ - Route multi-step tasks through workflow skills
32
+ - Use debug only as a last resort
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: awiki-bundle
3
+ version: 2.0.0
4
+ description: Route awiki-cli tasks to the correct shared, domain, workflow, or debug skill.
5
+ allowed-tools:
6
+ - Read
7
+ - Bash(awiki-cli:*)
8
+ metadata:
9
+ type: bundle
10
+ current_binary: awiki-cli
11
+ implemented_status: implemented
12
+ depends_on:
13
+ - awiki-shared
14
+ covered_commands:
15
+ - status
16
+ - docs
17
+ - schema
18
+ - doctor
19
+ - config.show
20
+ - version
21
+ - completion
22
+ ---
23
+
24
+ # awiki Bundle Skill
25
+
26
+ CRITICAL — Read `../awiki-shared/SKILL.md` before loading any other awiki skill.
27
+
28
+ ## Use This Skill For
29
+
30
+ - selecting the correct awiki skill for the task
31
+ - discovering the current product surface
32
+ - deciding whether the task needs a domain skill, workflow skill, or debug fallback
33
+
34
+ ## Product Surface
35
+
36
+ Use these commands before domain routing when you need context or validation:
37
+
38
+ - `awiki-cli status`
39
+ - `awiki-cli docs [topic]`
40
+ - `awiki-cli schema [command]`
41
+ - `awiki-cli doctor`
42
+ - `awiki-cli config show`
43
+ - `awiki-cli version`
44
+ - `awiki-cli completion <bash|zsh|fish|powershell>`
45
+
46
+ ## Routing
47
+
48
+ - identity, DID, handle, bind, recover, profile, import-v1 -> `../awiki-id/SKILL.md`
49
+ - direct message, group send, inbox, history, read state, secure-message contract -> `../awiki-msg/SKILL.md`
50
+ - group lifecycle, membership, policy, group state -> `../awiki-group/SKILL.md`
51
+ - runtime mode, websocket listener, daemon bridge, heartbeat contract -> `../awiki-runtime/SKILL.md`
52
+ - content pages, slug lifecycle, markdown publishing -> `../awiki-page/SKILL.md`
53
+ - people, followers, following, local contacts -> `../awiki-people/SKILL.md`
54
+ - first-time setup, migration, registration, runtime bootstrap -> `../awiki-workflow-onboarding/SKILL.md`
55
+ - group review, relationship discovery, intro drafting -> `../awiki-workflow-discovery/SKILL.md`
56
+ - local SQLite, raw RPC, schema cache, logs -> `../awiki-debug/SKILL.md`
57
+
58
+ ## Routing Order
59
+
60
+ 1. Read shared rules.
61
+ 2. Prefer canonical commands in the matching domain skill.
62
+ 3. Use a workflow skill for multi-step tasks.
63
+ 4. Use debug only when canonical commands or workflows do not cover the need.
64
+
65
+ ## Important Notes
66
+
67
+ - The current public binary is `awiki-cli`.
68
+ - `group` is a first-class domain and is not folded into `msg`.
69
+ - `people`, `msg secure`, `runtime heartbeat`, and several debug helpers are still partial or planned. Check the target skill before promising support.
70
+ - If the command shape is unclear, inspect `awiki-cli schema [command]` before improvising.
71
+
72
+ ## Command Discovery
73
+
74
+ - `awiki-cli --help`
75
+ - `awiki-cli schema`
76
+ - `awiki-cli <domain> --help`
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: awiki-debug
3
+ version: 2.0.0
4
+ description: Debugging helpers for local SQLite, raw RPC, schema cache, and logs.
5
+ allowed-tools:
6
+ - Read
7
+ - Bash(awiki-cli:*)
8
+ metadata:
9
+ type: debug
10
+ current_binary: awiki-cli
11
+ implemented_status: partial
12
+ depends_on:
13
+ - awiki-shared
14
+ covered_commands:
15
+ - debug.db.query
16
+ - debug.db.import-v1
17
+ planned_commands:
18
+ - debug.raw.rpc
19
+ - debug.schema-cache
20
+ - debug.logs
21
+ ---
22
+
23
+ # awiki Debug Skill
24
+
25
+ CRITICAL — Read `../awiki-shared/SKILL.md` first.
26
+
27
+ ## When to Use
28
+
29
+ Use debug only after these paths are insufficient:
30
+
31
+ 1. `awiki-cli status`
32
+ 2. `awiki-cli docs [topic]`
33
+ 3. `awiki-cli schema [command]`
34
+ 4. `awiki-cli doctor`
35
+ 5. `awiki-cli config show`
36
+ 6. the matching domain or workflow skill
37
+
38
+ ## Currently Available Commands
39
+
40
+ - `awiki-cli debug db query "<SQL>"`
41
+ - `awiki-cli debug db import-v1 [--path <legacy_dir>]`
42
+
43
+ ## Planned but Not Implemented Yet
44
+
45
+ - `awiki-cli debug raw rpc`
46
+ - `awiki-cli debug schema-cache`
47
+ - `awiki-cli debug logs [--follow]`
48
+
49
+ ## Safe-First Decision Tree
50
+
51
+ - if the problem is command shape or flags -> use `schema`
52
+ - if the problem is environment, config, or store state -> use `doctor`
53
+ - if the problem is active identity or runtime mode -> use `config show`
54
+ - only use `debug db query` for read-only or narrowly scoped inspection
55
+ - only use `debug db import-v1` after a dry run and explicit user confirmation
56
+
57
+ ## Restrictions
58
+
59
+ - do not run destructive SQL
60
+ - do not assume raw RPC exists before the command is implemented
61
+ - do not expose JWTs, private keys, secure session material, or unrelated local files
62
+ - do not use debug to bypass domain-level confirmation rules
63
+
64
+ ## Side Effects and Confirmation
65
+
66
+ | Command family | Effect | Confirmation rule |
67
+ |---|---|---|
68
+ | `debug db query` | local database inspection | safe for narrow non-destructive reads |
69
+ | `debug db import-v1` | local database mutation and migration import | explicit confirmation and dry run first |
70
+
71
+ ## Recovery Pattern
72
+
73
+ 1. inspect with `debug db query`
74
+ 2. translate the finding back into canonical runtime, identity, or message behavior
75
+ 3. return to the domain skill and avoid staying in debug longer than necessary
76
+
77
+ ## References
78
+
79
+ - `docs/architecture/awiki-skill-architecture.md`
80
+ - `docs/plan/phase-0/implementation-constraints.md`
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: awiki-group
3
+ version: 2.0.0
4
+ description: Group lifecycle, membership updates, policy changes, and group state inspection.
5
+ allowed-tools:
6
+ - Read
7
+ - Bash(awiki-cli:*)
8
+ metadata:
9
+ type: domain
10
+ current_binary: awiki-cli
11
+ implemented_status: implemented
12
+ depends_on:
13
+ - awiki-shared
14
+ covered_commands:
15
+ - group.create
16
+ - group.get
17
+ - group.join
18
+ - group.add
19
+ - group.remove
20
+ - group.leave
21
+ - group.update
22
+ - group.members
23
+ - group.messages
24
+ ---
25
+
26
+ # awiki Group Skill
27
+
28
+ CRITICAL — Read `../awiki-shared/SKILL.md` first.
29
+
30
+ ## Use This Skill For
31
+
32
+ - creating a group
33
+ - joining or leaving a group
34
+ - adding or removing members
35
+ - updating group profile or policy fields
36
+ - inspecting members or group messages
37
+
38
+ ## Core Concepts
39
+
40
+ - **group**: first-class resource with its own DID and policy
41
+ - **membership**: who is in the group and with what role
42
+ - **discoverability**: visibility and discovery policy
43
+ - **admission mode**: how members enter the group
44
+ - **group messages**: read path for group content; sending still uses `msg send --group`
45
+
46
+ ## Resource Model
47
+
48
+ - `Identity -> Group -> Members`
49
+ - `Group -> Policy Fields`
50
+ - `Group -> Group Messages`
51
+
52
+ ## Decision Rules
53
+
54
+ - need to create a group -> `group create`
55
+ - need to inspect metadata or policy -> `group get`
56
+ - need to join an existing open group -> `group join`
57
+ - need to add or remove one member -> `group add` / `group remove`
58
+ - need to change name, description, or policy -> `group update`
59
+ - need to send text into the group -> route to `../awiki-msg/SKILL.md`
60
+
61
+ ## Canonical Commands
62
+
63
+ - `awiki-cli group create --name "Agent War Room" [...]`
64
+ - `awiki-cli group get --group <group_did>`
65
+ - `awiki-cli group join --group <group_did> [--reason "..."]`
66
+ - `awiki-cli group add --group <group_did> --member <did|handle> [--role ...] [--reason "..."]`
67
+ - `awiki-cli group remove --group <group_did> --member <did|handle> [--reason "..."]`
68
+ - `awiki-cli group leave --group <group_did>`
69
+ - `awiki-cli group update --group <group_did> [--name ...] [--description ...] [...]`
70
+ - `awiki-cli group members --group <group_did> [--limit <n>]`
71
+ - `awiki-cli group messages --group <group_did> [--limit <n>] [--cursor <cursor>]`
72
+
73
+ ## Common Patterns
74
+
75
+ ### Create with dry run first
76
+
77
+ 1. `awiki-cli group create --name "Agent War Room" --dry-run`
78
+ 2. `awiki-cli group create --name "Agent War Room"`
79
+
80
+ ### Review before membership mutation
81
+
82
+ 1. `awiki-cli group get --group <group_did>`
83
+ 2. `awiki-cli group members --group <group_did>`
84
+ 3. `awiki-cli group add --group <group_did> --member <did> --dry-run`
85
+ 4. `awiki-cli group add --group <group_did> --member <did>`
86
+
87
+ ## Side Effects and Confirmation
88
+
89
+ | Command family | Effect | Confirmation rule |
90
+ |---|---|---|
91
+ | `group create` | creates a new group resource | explicit confirmation |
92
+ | `group join` | mutates membership state | explicit confirmation |
93
+ | `group add` / `group remove` | mutates membership state | explicit confirmation |
94
+ | `group leave` | removes the active identity from membership | explicit confirmation |
95
+ | `group update` | mutates group metadata or policy | explicit confirmation |
96
+
97
+ ## Error Handling
98
+
99
+ - missing or malformed group identifier -> inspect `awiki-cli schema group <subcommand>`
100
+ - access or role issue -> inspect `group get` and `group members` first
101
+ - transport or auth issue -> route to runtime or identity skill as needed
102
+
103
+ ## Implementation Notes
104
+
105
+ - `group` is a standalone domain in the current repo.
106
+ - `group messages` is read-only inspection; sending remains in `msg send --group`.
107
+
108
+ ## References
109
+
110
+ - `docs/architecture/awiki-v2-architecture.md`
111
+ - `docs/architecture/awiki-command-v2.md`
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: awiki-id
3
+ version: 2.0.0
4
+ description: DID, handle, contact binding, recovery, identity switching, and profile management.
5
+ allowed-tools:
6
+ - Read
7
+ - Bash(awiki-cli:*)
8
+ metadata:
9
+ type: domain
10
+ current_binary: awiki-cli
11
+ implemented_status: implemented
12
+ depends_on:
13
+ - awiki-shared
14
+ covered_commands:
15
+ - id.status
16
+ - id.list
17
+ - id.current
18
+ - id.use
19
+ - id.register
20
+ - id.bind
21
+ - id.resolve
22
+ - id.recover
23
+ - id.profile.get
24
+ - id.profile.set
25
+ - id.import-v1
26
+ hidden_commands:
27
+ - id.create
28
+ ---
29
+
30
+ # awiki Identity Skill
31
+
32
+ CRITICAL — Read `../awiki-shared/SKILL.md` first.
33
+
34
+ ## Use This Skill For
35
+
36
+ - creating or importing a local identity
37
+ - registering or recovering a handle-backed identity
38
+ - binding phone or email contact information
39
+ - switching the default identity
40
+ - reading or updating the DID profile
41
+
42
+ ## Core Concepts
43
+
44
+ - **identity**: the local awiki identity container selected with `--identity`
45
+ - **DID**: the protocol identifier used by the services
46
+ - **handle**: the human-friendly public identifier
47
+ - **contact binding**: adding phone or email to an existing identity
48
+ - **current identity**: the default local identity used when `--identity` is omitted
49
+
50
+ ## Lifecycle
51
+
52
+ `status -> create/register/import -> bind -> profile set -> current/use`
53
+
54
+ ## Decision Rules
55
+
56
+ - no local identity yet -> prefer `awiki-cli id register ...`; use hidden `id create` only for bootstrap, migration, or debug
57
+ - local identity exists but no handle-backed user state -> `awiki-cli id register ...`
58
+ - handle exists but contact info is incomplete -> `awiki-cli id bind ...`
59
+ - lost handle but still have recovery phone -> `awiki-cli id recover ...`
60
+ - need to inspect multiple local identities -> `awiki-cli id list`
61
+ - need to switch the default identity -> `awiki-cli id use <identity>`
62
+ - need to inspect public profile data -> `awiki-cli id profile get ...`
63
+
64
+ ## Canonical Commands
65
+
66
+ - `awiki-cli id status`
67
+ - `awiki-cli id list`
68
+ - `awiki-cli id current`
69
+ - `awiki-cli id use <identity>`
70
+ - `awiki-cli id register --handle <handle> (--phone <phone> [--otp <code>] | --email <email> [--wait])`
71
+ - `awiki-cli id bind (--phone <phone> [--otp <code>] | --email <email> [--wait])`
72
+ - `awiki-cli id resolve (--handle <handle> | --did <did>)`
73
+ - `awiki-cli id recover --handle <handle> --phone <phone> --otp <code>`
74
+ - `awiki-cli id profile get [--self | --handle <handle> | --did <did>]`
75
+ - `awiki-cli id profile set [--display-name ...] [--bio ...] [--tags ...] [--markdown ...] [--markdown-file ...]`
76
+ - `awiki-cli id import-v1 [--name <identity> | --all]`
77
+
78
+ ## Common Patterns
79
+
80
+ ### Preferred registration flow
81
+
82
+ 1. `awiki-cli id status`
83
+ 2. `awiki-cli id register --handle alice --phone +8613800138000 --otp 123456`
84
+ 3. `awiki-cli id current`
85
+ 4. `awiki-cli id bind --email alice@example.com --wait`
86
+ 5. `awiki-cli id profile set --display-name "Alice"`
87
+
88
+ ### Import from v1 before switching
89
+
90
+ 1. `awiki-cli id import-v1 --all --dry-run`
91
+ 2. `awiki-cli id import-v1 --all`
92
+ 3. `awiki-cli id list`
93
+ 4. `awiki-cli id use <identity>`
94
+
95
+ ## Side Effects and Confirmation
96
+
97
+ | Command family | Effect | Confirmation rule |
98
+ |---|---|---|
99
+ | `id register` | creates or completes remote user registration | explicit confirmation |
100
+ | `id bind` | mutates remote identity contact data | explicit confirmation |
101
+ | `id recover` | rebinds a handle using recovery flow | explicit confirmation |
102
+ | `id use` | changes local default identity | explicit confirmation |
103
+ | `id profile set` | mutates remote DID profile | explicit confirmation |
104
+ | `id import-v1` | imports local credentials and metadata | explicit confirmation |
105
+ | `id create` | creates local DID material only | explicit confirmation and only for internal/bootstrap use |
106
+
107
+ ## Error Handling
108
+
109
+ - registration or bind shape confusion -> inspect `awiki-cli schema id register` or `awiki-cli schema id bind`
110
+ - auth or token confusion -> recover or re-register the identity
111
+ - missing identity -> use `awiki-cli id list` and `awiki-cli id current`
112
+ - local store confusion -> use `awiki-cli doctor`
113
+
114
+ ## Implementation Notes
115
+
116
+ - `id create` is hidden on purpose.
117
+ - Public guidance must stay handle-first.
118
+ - `user_id` is not part of the public contract for this skill.
119
+
120
+ ## References
121
+
122
+ - `docs/architecture/awiki-v2-architecture.md`
123
+ - `docs/architecture/awiki-command-v2.md`