@zalom/plastic 1.0.0-alpha.27 → 1.0.0-alpha.28
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/package.json +1 -1
- package/scripts/lib/qmd_sync.rb +9 -10
package/package.json
CHANGED
package/scripts/lib/qmd_sync.rb
CHANGED
|
@@ -17,10 +17,6 @@ require "yaml"
|
|
|
17
17
|
module QmdSync
|
|
18
18
|
module_function
|
|
19
19
|
|
|
20
|
-
CONTEXT_DESCRIPTION =
|
|
21
|
-
"Plastic intent store: intents, specs, plans, checklists, outcomes, and insights " \
|
|
22
|
-
"for the What/Why/How/Exec lifecycle. Search here for past decisions and work."
|
|
23
|
-
|
|
24
20
|
# A runner is `->(args_array) { [stdout_string, success_boolean] }`.
|
|
25
21
|
# The default invokes the real `qmd` binary.
|
|
26
22
|
def default_runner
|
|
@@ -81,13 +77,16 @@ module QmdSync
|
|
|
81
77
|
stores
|
|
82
78
|
end
|
|
83
79
|
|
|
84
|
-
# Register a store directory as a collection
|
|
85
|
-
#
|
|
86
|
-
|
|
80
|
+
# Register a store directory as a collection. Idempotent: re-running is safe.
|
|
81
|
+
# `qmd collection add` exits non-zero when the collection already exists, so we
|
|
82
|
+
# check the collection list first and treat an existing collection as success.
|
|
83
|
+
# No-op when qmd is absent. (`qmd context add` attaches a summary to a document
|
|
84
|
+
# path, not a collection-level description, so it is not used here.)
|
|
85
|
+
def register(collection:, dir:, runner: default_runner, detector: method(:detect))
|
|
87
86
|
return skip_result unless detector.call
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{ ran: true, ok:
|
|
87
|
+
return { ran: true, ok: true, output: "exists" } if list_collections(runner).include?(collection)
|
|
88
|
+
out, ok = runner.call(["collection", "add", dir, "--name", collection])
|
|
89
|
+
{ ran: true, ok: ok, output: out.to_s.strip }
|
|
91
90
|
end
|
|
92
91
|
|
|
93
92
|
# Re-index a single collection: refresh the corpus then its embeddings.
|